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

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
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,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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