Shape.Range isn't updating unless I enter the cell and press Enter? - Help!

TTUK

Board Regular
Joined
Apr 5, 2012
Messages
137
Hello all,

I have an image named GenPPE on the WorkSheet Gen, and
on the Worksheet named Dash I have a checkbox which updates LinkedCell to AQ36

When the location of Dash AQ36 = True, the image called GenPPe on Worksheet Gen is to show, and if it is = False, then it doesn't not show.

I'm struggling to get this to work without having to click on the Cell and press Enter.
I have tried
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
and
VBA Code:
Worksheet_Open
but I cannot seem to get it to do the trick!

Here is my VBA so far -
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim Cell As Range
On Error Resume Next

For Each Cell In Range("$AQ36")
    If Cell.Value = True Then
        Sheets("Dash").Shapes.Range(Array("GenPPE")).Visible = True
    Else
        Sheets("Dash").Shapes.Range(Array("GenPPE")).Visible = False
    End If
Next Cell
    
End If
End Sub

I have this Code in the Object of the Worksheet Dash

Hope someone can help me out! As I just want to click the Checkboxes on Dash, for them to update the Shapes automatically on Gen.

Thanks!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Instead of using Worksheet_Change on the cell, use a change event for the checkbox. Is it an ActiveX or Forms checkbox?
 
Upvote 0
Hello.

It is an ActiveX checkbox.
I'm not sure how to write a Change Event?

Thanks,
 
Upvote 0
Would like to update you that adding the formula to the Checkbox VBA worked!

Here is the code for anyone else who may have a similar thing they are trying to do involving checkboxes showing or hiding shapes.

VBA Code:
Private Sub CheckBox5_Click()
    If CheckBox5.Value = True Then Range("AR36").Value = 1
    If CheckBox5.Value = False Then Range("AR36").Value = 0
    
Dim Cell As Range
On Error Resume Next
   
    For Each Cell In Range("$AR36")
    If Cell.Value = 1 Then
        Sheets("Gen").Shapes.Range(Array("GenPPE1")).Visible = True
    Else
        Sheets("Gen").Shapes.Range(Array("GenPPE1")).Visible = False
    End If
Next Cell

End Sub
 
Upvote 0
Solution
VBA Code:
Private Sub CheckBox5_Click()

That's the change event.
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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