Macro question

Mldeuser

Well-known Member
Joined
Dec 27, 2008
Messages
563
Office Version
  1. 365
Platform
  1. Windows
Is it possible to have a macro run by changing a cell.

I would like to have a macro run that hides certain rows depending on whether cell "Q6" has an "A" or a "C" in it
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Sure: Use the WorkSheet_Change event
Code:
Private Sub WorkSheet_Change(ByVal Target as Range)
If Target.Address <> "$Q$6" Then Exit Sub
Select Case Target
    Case "A"
        'Code to Hide rows
    Case "C"
        'Code to Unhide Rows
    Case Else:
End Select
End Sub
Which rows do you want to hide?

lenze
 
Upvote 0
When the letter "A" is used I need to hide rows 42-45, 63-68.

When the letter "C" is used I need to hide rows 30-41, 56-60, 68-77

Thanks for the help
 
Upvote 0

Forum statistics

Threads
1,203,534
Messages
6,055,955
Members
444,839
Latest member
laurajames

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