Modify Code for multiple objects and cells

jeffst

New Member
Joined
May 21, 2018
Messages
8
Hello,

I am a novice with VBA, but I was able to get this code to work. The problem is that I want the code to apply to 29 other objects. the range of cells are from row 118 to row 123 and columns 26 to 30 (30 cells total). Each object is tied to the outcome of each cell. If the cell is blank, the corresponding object is not visible. How can I add to this code to get it to apply to all of my 30 objects?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 118 And Target.Column = 26 Then
If Target.Value <> vbNullString Then
ActiveSheet.Shapes("Arc 120").Visible = True
Else
ActiveSheet.Shapes("Arc 120").Visible = False
End If
End If
End Sub
 
I don't know why you're getting that error. Are you putting the code in the sheet module of the sheet containing the Z118:AD123 cells? Right-click the sheet tab and click View Code.
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
I was testing out a duplicate of the same sheet with your other code on it. I deleted the duplicate sheet and now the VBA code is working. Thanks so much for your help!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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