radio button not registering
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

replyReply Thu 10 Nov 2011, 11:39Delegate Mo said...

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

For upcoming training course dates see: Pricing & availability

replyReply Fri 11 Nov 2011, 12:59Trainer Anthony said...

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

 

Please browse our web site to find out more about
excel computer training london and other Microsoft training courses.

Excel tip:

Conditional formatting for cells that return text , not picked up by Go to command

If you have tried to format all cells containing text even those that display text as a result of a formula you may have had difficulty. As Go to command with constant selected does not pick up formulas that result in text.

Then try this. Select the range the formula cells appear in on your sheet. Format, select Conditional Formatting menu. In the dialog box under Condition 1, select "Formula Is" from drop down. Next to it in the Formula Box, enter the formula =Istext(A1. Click Format button , choose desired formatting settings and click OK. To go ahead and apply the conditional formatting click OK to accept

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard