Hello,
I have a workbook with multiple sheets. Each sheet has a (different) code which is executed when I switch to that sheet. One of the sheets (A) has linked pictures in the first column. When I switch to sheet (B) I execute some code which, after populating the sheet with text values from other sheets simply goes through a range of rows and hides any rows which didn't have data in them. That code is simply:
If I delete all ~150 images in sheet A and switch to sheet B it takes less than a minute to execute sheet B's code. If I keep all the images in sheet A, it takes ~40-50 minutes! Other functions have also slowed down, but the For-Next loop above is by far the slowest (I put time-stamps between different lines of the code to check). Right now, my work around is to delete the images prior to executing sheet B's code (the images get placed on sheet A via another macro as linked pictures) and then putting them back when switching to sheet A again, but that seems really kludgy.
Since the code above doesn't rely on sheet A, I don't understand why things slow down with the images.
Any and all insight is appreciated.
Thanks,
Jeff
I have a workbook with multiple sheets. Each sheet has a (different) code which is executed when I switch to that sheet. One of the sheets (A) has linked pictures in the first column. When I switch to sheet (B) I execute some code which, after populating the sheet with text values from other sheets simply goes through a range of rows and hides any rows which didn't have data in them. That code is simply:
Code:
For Each xRg In Range("F17:F117")
If xRg.Value = "" Then
xRg.EntireRow.Hidden = True
Else
xRg.EntireRow.Hidden = False
End If
Next xRg
If I delete all ~150 images in sheet A and switch to sheet B it takes less than a minute to execute sheet B's code. If I keep all the images in sheet A, it takes ~40-50 minutes! Other functions have also slowed down, but the For-Next loop above is by far the slowest (I put time-stamps between different lines of the code to check). Right now, my work around is to delete the images prior to executing sheet B's code (the images get placed on sheet A via another macro as linked pictures) and then putting them back when switching to sheet A again, but that seems really kludgy.
Since the code above doesn't rely on sheet A, I don't understand why things slow down with the images.
Any and all insight is appreciated.
Thanks,
Jeff