Hiding and Unhiding row Macro help

misula29

New Member
Joined
Mar 6, 2009
Messages
28
First off, im a new-B at VBS.... I have a spreadsheet with two section, only one of the sections is unhidden at a time based on the user clicking on 1 of 2 option buttons.... I recorded and assigned a macro to do this function and it works beautifully... my problem is a little more complicated...

In each of the two sections there is a question for the user and a listing combo box for the user to select an option. If a user is to select a option button,(unhidding or hidding the corresponding section) and select an option in the drop down combobox, THEN select the other option button the macro bombs

I think i need some VBS language to clear the comboboxes before the rows are hidden but i cant figure it out.... this is what the VSB is for the macros i have already done....

Sub NoClaims2()
'
' NoClaims2 Macro
'
'
Rows("75:79").Select
Selection.EntireRow.Hidden = False
Rows("79:85").Select
Selection.EntireRow.Hidden = True
End Sub
Sub WithClaims2()
'
' WithClaims2 Macro
'
'
Rows("78:87").Select
Selection.EntireRow.Hidden = False
Rows("76:78").Select
Selection.EntireRow.Hidden = True
End Sub
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Not sure about what is crashing your macro, but the syntax on your macros can be tighted up. There's no need to select rows before hiding them.
Rich (BB code):
Sub NoClaims2()
    Rows("75:79").EntireRow.Hidden = False
    Rows("79:85").EntireRow.Hidden = True
End Sub

Sub WithClaims2()
    Rows("78:87").EntireRow.Hidden = False
    Rows("76:78").EntireRow.Hidden = True
End Sub

But you do see how the rows overlap? You are using 79 in both the false and the true portions...
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top