![]() |
Macro for running on preotected sheets
Hi All,
I am using the code below but when I protect the sheet it doesn't work, can someone help on this problem please. Sub TeamLeadersLates() Dim MyDate As Date, StringDate As String With Sheets("Daily Sheet") StringDate = InputBox("Enter Date") If IsDate(StringDate) Then MyDate = DateValue(StringDate) .Range("E2") = MyDate Else MsgBox "Invalid Date" Exit Sub End If .Range("$B$4:$D$1000").AutoFilter Field:=1 .Range("$B$4:$D$1000").AutoFilter Field:=4 .Range("$B$4:$D$1000").AutoFilter Field:=4, Criteria1:="LTL" Sheets("Daily Sheet").Select End With End Sub |
Macro for running on preotected sheets
Hi,
Unprotect and then re-protext the sheet at runtime Sheets("Daily Sheet").Unprotect Password:="Mypass" 'Your code Sheets("Daily Sheet").Protect Password:="Mypass" Mike "Yogin" wrote: Hi All, I am using the code below but when I protect the sheet it doesn't work, can someone help on this problem please. Sub TeamLeadersLates() Dim MyDate As Date, StringDate As String With Sheets("Daily Sheet") StringDate = InputBox("Enter Date") If IsDate(StringDate) Then MyDate = DateValue(StringDate) .Range("E2") = MyDate Else MsgBox "Invalid Date" Exit Sub End If .Range("$B$4:$D$1000").AutoFilter Field:=1 .Range("$B$4:$D$1000").AutoFilter Field:=4 .Range("$B$4:$D$1000").AutoFilter Field:=4, Criteria1:="LTL" Sheets("Daily Sheet").Select End With End Sub |
Macro for running on preotected sheets
You can protect your sheet with the argument UserInterfaceOnly set to True.
-- Wigi http://www.wimgielis.be = Excel/VBA, soccer and music "Yogin" wrote: Hi All, I am using the code below but when I protect the sheet it doesn't work, can someone help on this problem please. Sub TeamLeadersLates() Dim MyDate As Date, StringDate As String With Sheets("Daily Sheet") StringDate = InputBox("Enter Date") If IsDate(StringDate) Then MyDate = DateValue(StringDate) .Range("E2") = MyDate Else MsgBox "Invalid Date" Exit Sub End If .Range("$B$4:$D$1000").AutoFilter Field:=1 .Range("$B$4:$D$1000").AutoFilter Field:=4 .Range("$B$4:$D$1000").AutoFilter Field:=4, Criteria1:="LTL" Sheets("Daily Sheet").Select End With End Sub |
Macro for running on preotected sheets
Thanks for your help Mike H & Wigi. Code works fine.
"Wigi" wrote: You can protect your sheet with the argument UserInterfaceOnly set to True. -- Wigi http://www.wimgielis.be = Excel/VBA, soccer and music "Yogin" wrote: Hi All, I am using the code below but when I protect the sheet it doesn't work, can someone help on this problem please. Sub TeamLeadersLates() Dim MyDate As Date, StringDate As String With Sheets("Daily Sheet") StringDate = InputBox("Enter Date") If IsDate(StringDate) Then MyDate = DateValue(StringDate) .Range("E2") = MyDate Else MsgBox "Invalid Date" Exit Sub End If .Range("$B$4:$D$1000").AutoFilter Field:=1 .Range("$B$4:$D$1000").AutoFilter Field:=4 .Range("$B$4:$D$1000").AutoFilter Field:=4, Criteria1:="LTL" Sheets("Daily Sheet").Select End With End Sub |
All times are GMT +1. The time now is 11:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com