Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

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

ResolvedVersion 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:

Bracketed negative numbers

Often Excel users wish to display negative numbers in colour red and bracketed

Intstructions
Step1. Select Format > Cells menu options. Within Numbers tabsheet, select Category = Custom.
Step 2. Select a type such as #,##0;[Red]-#,##0;; that specifies a colour in square brackets.
Step 3. Amend as follows; #,##0;[Red](#,##0;;

Notes: Excel formatting featues are of the form
"Positive; Negative;Zero;Text" separated by semicolon.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.