Event code - trigger from another worksheet

Sheripres

Board Regular
Joined
Sep 7, 2011
Messages
91
Hello:

I have two sheet tabs: Step 1 and Step 2.

Step 2 has a drop down where you can either choose Yes or No in various cells. Depending on the answer, rows either hide or unhide. No problem.

But, now I am being asked to go up a notch:

in Step 1, I have cell G8 that has a drop down menu and when something is chosen, the cell in the Step 2 sheet tab automatically puts in YES (instead of having the drop down list).

The problem is, I cannot seem to trigger the event code for Step 2 to unhide the rows. It will only unhide them if I am clicking on the cell.

I know it has to do with "active sheet", but I don't know how to have an event code run when the worksheet is inactive.

The event code in Step two is Worksheet_Change.

Thank you for your time and help.

Sheri
 
Ok, how about
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.CountLarge > 1 Then Exit Sub
   Select Case LCase(Target.Value)
      Case "[COLOR=#ff0000]on site[/COLOR]", "[COLOR=#ff0000]complete[/COLOR]", "[COLOR=#ff0000]pending[/COLOR]"
         Sheets("Step2").Range("C3").Value = "Yes"
      Case Else
         Sheets("Step2").Range("C3").Value = "No"
   End Select
End Sub
Change the values in red to match the criteria for "Yes" and leave the step2 code intact.
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
It works in a way. I notice I cannot upload a file, right? I created a small file to show you what is happening, but I don't know how to do that. I did screen shots, but I don't have a URL to upload them too. I am at work, so they might block me if I try to upload to a website (which I have never done before).

Your second code is totally different from your first one. It didn't like something. I am going to keep playing with it. If anything, I will figure out something else.

You really have been super helpful to me! I am keeping these codes for future reference!

Thank you!

Sheri
 
Upvote 0
It works in a way. I notice I cannot upload a file, right?
Correct, you cannot upload files to this site, but you can upload to OneDrive, or dropbox, mark it for sharing & then post the link to the thread.
 
Upvote 0
I figured out the issue and want to share it here.

Instead of using Worksheet_Change event code, I used Worksheet_Activate and it worked!
 
Upvote 0
Glad you got it sorted & thanks for the feedback
 
Upvote 0
Thank you!

I try and make sure if I get the answer, go back to the forum and post it.

When I Google a question and I see my same exact question on a thread, I get disappointed when the person says they figured it out and never put the answer in their thread.

It is like telling a joke and not the punchline. :)
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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