![]() |
Hiding Pictures "Run-time error '1004'"
In my spreadsheet I am hiding or unhiding grouped drawing images based on a
cell value. The vba code works fine until I get up to a certain amount of images. Is there a limit on the number of images that can be hidden or is something else wrong? Below is the code. Like I stated above, the code works fine until I get about 45 or more images in the sheet. Thanks in advance. Private Sub Worksheet_Calculate() Dim oPic As Object Dim AmpRange As Range Sheet13.DrawingObjects.Visible = False Sheet13.Pictures.Visible = False Sheet13.Shapes("Picture 1").Visible = True Sheet13.Shapes("Picture 2").Visible = True For Each AmpRange In Sheet13.Range("D12:I12") With AmpRange For Each oPic In Sheet13.Shapes If oPic.Name = .Text Then oPic.Visible = True Exit For End If Next oPic End With Next AmpRange End Sub |
Hiding Pictures "Run-time error '1004'"
I've seen this with lots of pictures, too.
I just loop to hide them: dim pic as picture .... for each pic in me.pictures pic.visible = false next pic truthband wrote: In my spreadsheet I am hiding or unhiding grouped drawing images based on a cell value. The vba code works fine until I get up to a certain amount of images. Is there a limit on the number of images that can be hidden or is something else wrong? Below is the code. Like I stated above, the code works fine until I get about 45 or more images in the sheet. Thanks in advance. Private Sub Worksheet_Calculate() Dim oPic As Object Dim AmpRange As Range Sheet13.DrawingObjects.Visible = False Sheet13.Pictures.Visible = False Sheet13.Shapes("Picture 1").Visible = True Sheet13.Shapes("Picture 2").Visible = True For Each AmpRange In Sheet13.Range("D12:I12") With AmpRange For Each oPic In Sheet13.Shapes If oPic.Name = .Text Then oPic.Visible = True Exit For End If Next oPic End With Next AmpRange End Sub -- Dave Peterson |
Hiding Pictures "Run-time error '1004'"
Thanks Dave. Shortly after posting this I came to the same conclusion.
"Dave Peterson" wrote: I've seen this with lots of pictures, too. I just loop to hide them: dim pic as picture .... for each pic in me.pictures pic.visible = false next pic truthband wrote: In my spreadsheet I am hiding or unhiding grouped drawing images based on a cell value. The vba code works fine until I get up to a certain amount of images. Is there a limit on the number of images that can be hidden or is something else wrong? Below is the code. Like I stated above, the code works fine until I get about 45 or more images in the sheet. Thanks in advance. Private Sub Worksheet_Calculate() Dim oPic As Object Dim AmpRange As Range Sheet13.DrawingObjects.Visible = False Sheet13.Pictures.Visible = False Sheet13.Shapes("Picture 1").Visible = True Sheet13.Shapes("Picture 2").Visible = True For Each AmpRange In Sheet13.Range("D12:I12") With AmpRange For Each oPic In Sheet13.Shapes If oPic.Name = .Text Then oPic.Visible = True Exit For End If Next oPic End With Next AmpRange End Sub -- Dave Peterson |
All times are GMT +1. The time now is 04:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com