Code:
End If
If Selection.Count = 1 Then
If Not Intersect(Target, Range("B1")) Is Nothing Then
Call PrintEmployeeList
End If
End If
End Sub
the code below is in the module
Code:
Sub PrintEmployeeList()
ActiveSheet.Unprotect Password:="TEST"
Dim lastrow As Long
Sheets("EMPLOYEE LIST").Copy Before:=Sheets(1)
Sheets("EMPLOYEE LIST (2)").Select
Columns("G:I").EntireColumn.Hidden = True
Columns("M:M").ClearContents
Range("B2:K1000").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveSheet.PageSetup.Orientation = xlPortrait
lastrow = Cells.SpecialCells(xlLastCell).Row
lastrow = Cells(Cells.Rows.Count, "J").End(xlUp).Row
ActiveSheet.PageSetup.PrintArea = "$A$1:$J$" & lastrow
ActiveSheet.PageSetup.LeftMargin = _
Application.InchesToPoints(1.5)
ActiveSheet.PageSetup.TopMargin = _
Application.InchesToPoints(1)
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
Application.DisplayAlerts = False
Sheets("EMPLOYEE LIST (2)").Delete
Application.DisplayAlerts = True
Sheets("EMPLOYEE LIST").Select
ActiveSheet.Protect Password:="TEST"
End Sub
when double click on B1 it runs the macro great except after the completion it comes up with the error " The cell or chart you're trying change is on a protected sheet......" i can simply unlock cell B1 but to avoid the message however, I prefer if i kept it locked while protected.
when i tried just putting the code with the rest of the double click function I get an error on line
Code:
Range("B2:K1000").Select
any suggestions.