Good morning guys,
I am stuck at one point.
I have a cell (A1) where I put a dropdown list with 2 choices (simply made by a Data Validation). And I want to run my macro when I change the value of this cell (ON / OFF).
If I change something else on the sheet/workbook, I don't want to run it.
So, basically, I have this code in "ThisWorkbook"
And here is what's inside my Module1
The macro is working, it's doing what I want but it seems that it's starting the macro each time that I click on a cell. Up to know, it's not really a big issue as it slow down the file for a few ms (maybe?) but they sould be a way to do it... Especially for longer code with much more macros.
I've tried differents solution I found on the forum (If Intersect(target, Range("A1")) Is... // If target.Address = "A1"// ...) but I couldn't find the right one in my case... Or I couldn't make it suitable for me.
Any tips?
Thanks!
Vanrob
PS: Just in case it could be usefull, here is a link to my file
https://www.dropbox.com/s/38zn6k16n37exyz/Vanrob file.xlsm?dl=0
I am stuck at one point.
I have a cell (A1) where I put a dropdown list with 2 choices (simply made by a Data Validation). And I want to run my macro when I change the value of this cell (ON / OFF).
If I change something else on the sheet/workbook, I don't want to run it.
So, basically, I have this code in "ThisWorkbook"
Code:
Private Sub Workbook_Open()
Shift
End Sub
And here is what's inside my Module1
Code:
Sub Shift()
If ActiveSheet.Range("A1").Value = "OFF" Then
Cells.EntireRow.Hidden = False
Rows("71:139").EntireRow.Hidden = True
Else
Cells.EntireRow.Hidden = False
Rows("71:139").EntireRow.Hidden = False
End If
End Sub
The macro is working, it's doing what I want but it seems that it's starting the macro each time that I click on a cell. Up to know, it's not really a big issue as it slow down the file for a few ms (maybe?) but they sould be a way to do it... Especially for longer code with much more macros.
I've tried differents solution I found on the forum (If Intersect(target, Range("A1")) Is... // If target.Address = "A1"// ...) but I couldn't find the right one in my case... Or I couldn't make it suitable for me.
Any tips?
Thanks!
Vanrob
PS: Just in case it could be usefull, here is a link to my file
https://www.dropbox.com/s/38zn6k16n37exyz/Vanrob file.xlsm?dl=0