radio button not registering

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Radio button not registering a click

Radio button not registering a click

resolvedResolved · High Priority · Version 2007

Mo has attended:
Excel VBA Intro Intermediate course

Radio button not registering a click


Hi,

when I'm clicking between two radio buttons, at one point a click is not registering.

I'm using form controls with a lookup sheet. One macro is assigned to each button with an IF statement.

When I click from option 1 to 2 it's fine, then click back to 1 is fine, then clcik 2 and it doesn't register as a click and the macro doesn't actually run.

The lookup sheet is giving me a value of zero, when it should be 1 or 2.

The code is below and it's not working because of the hide row command, if i comment this out then it will work.

Thanks

Mo


Sub NPSHideRow()

'Hide pivot row
If ThisWorkbook.Sheets("Lookup").Range("H4") = 1 And ThisWorkbook.Sheets("Lookup").Range("C4") = 3 Then

ThisWorkbook.Sheets("NPS Report").Range("j51").Borders.LineStyle = xlNone
ThisWorkbook.Sheets("NPS Report").Range("j51").Delete shift:=xlToLeft

ThisWorkbook.Sheets("NPS Report").Rows("50").Hidden = False


ElseIf ThisWorkbook.Sheets("Lookup").Range("H4") = 2 And ThisWorkbook.Sheets("Lookup").Range("C4") = 3 Then

ThisWorkbook.Sheets("NPS Report").Range("j51").Value = ThisWorkbook.Sheets("NPS Report").Range("j50").Value

With ThisWorkbook.Sheets("NPS Report").Range("j51")
.Borders.LineStyle = xlContinuous
.NumberFormat = "#,###"
End With

ThisWorkbook.Sheets("NPS Report").Rows("50").Hidden = True


End If


End Sub

RE: Radio button not registering a click

Hi Mo, thanks for your query. That's a difficult one to advise you on from afar, I'm afraid because it sounds like the structural changes on the sheet are causing the problems. Try teasing your code out into separate subroutines and altering the visibility of your rows right at the end of the process rather than in the middle of it. Use MsgBoxes to pick up the state of each button at each stage. Other than that, we'd need the spreadsheet to advise further.

Hope this helps,

Anthony

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Hiding a worksheet in Excel

Want to circulate an Excel workbook file but keep certain worksheets hidden from your colleagues' view?

You can do so by bringing up the sheet you wish to hide on your screen; then going to Format - Sheet - Hide.

It will not be immediately obvious that a sheet is hidden from view unless perhaps the sheet are still labelled Sheet 1, Sheet 2 etc.

To display the sheet again, you can go to Format - Sheet - Unhide on any of the other sheets in the workbook. A dialogue box will appear, allowing you to select the hidden sheet/s. Click OK to make the sheet/s reappear again.

View all Excel hints and tips


Server loaded in 0.07 secs.