Using Multiple Private Sub Worksheet_Change (ByVal Target As Range)

kcmick87

New Member
Joined
Dec 7, 2022
Messages
3
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. MacOS
  3. Mobile
Hello All,

I am very new to VBA and am really hoping someone can help me.

I am trying to create a worksheet that hides different rows depending on the drop down responses in various cells ie. please select, yes, no. The first drop down works but when I copy the code for the second drop down, the second drop down does not. Please help!

1670445795047.png
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I would change your target lines as follows:
VBA Code:
if not intersect (target, range("C13")) is nothing then
similarly
VBA Code:
if not intersect (target, range("C36")) is nothing then

This way, the event will do nothing unless either C13 or C36 were changed.
 
Upvote 0
I would change your target lines as follows:
VBA Code:
if not intersect (target, range("C13")) is nothing then
similarly
VBA Code:
if not intersect (target, range("C36")) is nothing then

This way, the event will do nothing unless either C13 or C36 were changed.
Hi thanks for your help!

Now I am getting a Compile Error" Block If without End If
 
Upvote 0
Hi Everyone I was able to figure it out by specifying the range

1670450711438.png
 
Upvote 0
Solution

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

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