Combining Multiple Worksheet Change Events

Paul_11

New Member
Joined
Jul 13, 2015
Messages
5
Hi,

I am new to VBA and am having some trouble combining two worksheet change events.

As I understand you can only have one event per worksheet.

One macro hides rows 8:9 if cell E14="" and unhides if otherwise.

The other macro would hide rows 20:21 if cel E15="" and unhide if otherwise.

How can I combine these two change events?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi,
Welcome to forum.
Its always helpful if you post code you have but to give some idea, something like following may do what you want:

Code:
 Private Sub Worksheet_Change(ByVal Target As Range)    
   If Not Intersect(Target, Me.Range("E14:E15")) Is Nothing Then
        Me.Rows("8:9").EntireRow.Hidden = Me.Range("E14").Value = ""
        Me.Rows("20:21").EntireRow.Hidden = Me.Range("E15").Value = ""
    End If
End Sub

Be aware though that change event will not trigger if cell values are changed by formula.

Dave
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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