VBA for show/hide shape based upon value in another sheet

DOSDK

New Member
Joined
Jun 26, 2013
Messages
2
Hi guys,


I would like to have a shape visible, if the value in cell B7 is "WE", and hidden if not. With the VBA below, I am able to do that. HOWEVER, when the content of B7 equels the value in a cell in another sheet, it does not work - only when I write in cell B7 myself and hit Enter.

Can anyone help me modyfy my code below to fix this?


Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   
  If ActiveSheet.Range("B7").Value = "WE" Then
     
        ActiveSheet.Shapes("Box").Visible = False
     Else
        ActiveSheet.Shapes("Box").Visible = True
     End If

End Sub


Thanks
Dorthe
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   
   
  If ActiveSheet.Range("B7").[B][COLOR=#0000cd]Text [/COLOR][/B]= "WE" Then
     
        ActiveSheet.Shapes("Box").Visible = False
     Else
        ActiveSheet.Shapes("Box").Visible = True
     End If

   
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

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