So, I have the below code, that is hiding all rows with 1 in column. Each time when the file name has to be changed I have to change the code.
Workbooks("New R.M.S. Holiday Planner.xlsm").Worksheets("Planner").Activate
Instead of New R.M.S. Holiday Planner.xlsm I would like to point this to Cell A1, where I will have file name.
Probably it is something silly, but I can't work it out. Thanks for your help.
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Workbooks("New R.M.S. Holiday Planner.xlsm").Worksheets("Planner").Activate
With Sheets("Planner")
Rows("11:1897").EntireRow.Hidden = False
Application.ScreenUpdating = False
For Each Cell In Range("BE10:BE1897")
If Cell.Value = 1 Then Cell.EntireRow.RowHeight = 0.00001
Next Cell
Range("Y2:AF2").Select
ActiveCell.FormulaR1C1 = "S&S Days"
Range("A1").Select
' .Protect Password:="folder"
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End With
Else
If CheckBox1.Value = False Then
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Workbooks("New R.M.S. Holiday Planner.xlsm").Worksheets("Planner").Activate
With Sheets("Planner")
For Each Cell In Range("BE10:BE1897")
If Cell.Value = 1 Then Cell.EntireRow.RowHeight = 12.75
Next Cell
Range("Y2:AF2").Select
ActiveCell.FormulaR1C1 = "All"
Range("A1").Select
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End With
End If
End If
End Sub