woodnathan
New Member
- Joined
- Oct 25, 2023
- Messages
- 6
- Office Version
- 365
- Platform
- Windows
We have several spreadsheets that use VBA to assign a named range to a shape. Basically, another macro draws a picture inside a range named "CS". Then, the chunk of code below assigns the named range to the shape. A picture of the range will show in the shape. This has worked forever. In fact, it still works on my computer. But on my coworkers machine, it has suddenly started kicking out a '1004' error when it tries to set the DrawingObject.Formula = "".
I've checked it on other computers in the office and it works on theirs.
If I select the shape and type =CS into the formula bar, I don't get an error, but the picture doesn't update anymore.
If I select the shape and delete what is in the formula bar, (setting the formula value to ""), I get an error.
Again, this works on everyone else's computer. I've tried every setting in Options I can think of and checked references, but I'm stumped.
Figured I'd take it to the masses.
Offending chunk of code:
--------------------------
Private Sub Worksheet_Activate()
Sheets("Macro References").Range("A5").Value = 0
Sheets("Input").Shapes("CS_View").DrawingObject.Formula = "=CS"
End Sub
--------------------------
Private Sub Worksheet_Deactivate()
Sheets("Input").Shapes("CS_View").DrawingObject.Formula = ""
End Sub
I've checked it on other computers in the office and it works on theirs.
If I select the shape and type =CS into the formula bar, I don't get an error, but the picture doesn't update anymore.
If I select the shape and delete what is in the formula bar, (setting the formula value to ""), I get an error.
Again, this works on everyone else's computer. I've tried every setting in Options I can think of and checked references, but I'm stumped.
Figured I'd take it to the masses.
Offending chunk of code:
--------------------------
Private Sub Worksheet_Activate()
Sheets("Macro References").Range("A5").Value = 0
Sheets("Input").Shapes("CS_View").DrawingObject.Formula = "=CS"
End Sub
--------------------------
Private Sub Worksheet_Deactivate()
Sheets("Input").Shapes("CS_View").DrawingObject.Formula = ""
End Sub