Hello
I am currently trying to get a spreadsheet to perform a macro if the cell has the correct contents. I think i have managed to get the code correct, but im not sure how to get the code to execute. I originally had the code assigned to a button and it worked fine, but now I have taken the button away and replaced it with an if function im not sure how to get it to work.
the cell K1 has a list in it also, users pick a selection from the list and then the code displays the correct rows.
I am currently trying to get a spreadsheet to perform a macro if the cell has the correct contents. I think i have managed to get the code correct, but im not sure how to get the code to execute. I originally had the code assigned to a button and it worked fine, but now I have taken the button away and replaced it with an if function im not sure how to get it to work.
the cell K1 has a list in it also, users pick a selection from the list and then the code displays the correct rows.
Code:
Sub LadiesShirts()
'
' LadiesShirts Macro
If Range("K1").Value = "Ladies" Then
Rows("5:6").Select
Selection.EntireRow.Hidden = True
Rows("27:145").Select
Selection.EntireRow.Hidden = True
Rows("7:26").Select
Selection.EntireRow.Hidden = False
End If
End Sub