Evagrius Ponticus
Well-known Member
- Joined
- May 24, 2007
- Messages
- 1,467
Hi All,
In a worsheet, any time a user activates a cell in column G in rows 1 through 16 a picture will appear - each row has a different picture. Once a user activates any row outside that range, any visible picture will be hidden. I don't want this code to run at every selection change because it is causing the screen to flicker even with screen updating set to false.
So, once a user selects a cell outside rows 1 through 16, any visible picture will be hidden. Then if a user selects still another cell outside the range - the code should not run again since no pic is visible.
I tried using a static variable, but it always starts at FALSE so that didn't work. Can anyone please advice?
In a worsheet, any time a user activates a cell in column G in rows 1 through 16 a picture will appear - each row has a different picture. Once a user activates any row outside that range, any visible picture will be hidden. I don't want this code to run at every selection change because it is causing the screen to flicker even with screen updating set to false.
So, once a user selects a cell outside rows 1 through 16, any visible picture will be hidden. Then if a user selects still another cell outside the range - the code should not run again since no pic is visible.
I tried using a static variable, but it always starts at FALSE so that didn't work. Can anyone please advice?
Code:
Static MyVar As Boolean
If MyVar = false then exit sub
Rem SHOW PICTURES
If ActiveCell.Address = Range("New").Address Then
ActiveSheet.Shapes("House").Visible = True: MyVar = True
Else
ActiveSheet.Shapes("House").Visible = False: MyVar = False
End If
If MyVar = True Then GoTo End
If ActiveCell.Address = Range("ronW").Address Then
ActiveSheet.Shapes("White").Visible = True: MyVar = True
Else
ActiveSheet.Shapes("White").Visible = False: MyVar = False
End If