Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro attached to a button that is supposed to remove the filter by
using the command ShowAllData. As long as I don't protect the worksheet it works fine. As soon as I turn on protection I get a VBA error. Any help here? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How about adding code to unprotect the sheet, showall the data, then reprotect
the worksheet? JTreks wrote: I have a macro attached to a button that is supposed to remove the filter by using the command ShowAllData. As long as I don't protect the worksheet it works fine. As soon as I turn on protection I get a VBA error. Any help here? -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, Dave. Tried it... I hangs on the ShowAllData line. I know this line
is a valid line because the button (macro) works correctly when I do not protect the worksheet. Any idea what else it might be? Thanks "Dave Peterson" wrote: How about adding code to unprotect the sheet, showall the data, then reprotect the worksheet? JTreks wrote: I have a macro attached to a button that is supposed to remove the filter by using the command ShowAllData. As long as I don't protect the worksheet it works fine. As soon as I turn on protection I get a VBA error. Any help here? -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It might be best to share the code you tried.
But I'd use something like: Dim myPWD as String myPWD = "hi" With Worksheets("somesheethere") 'or ActiveSheet or Me .unprotect password:=mypwd If .FilterMode Then .ShowAllData End If .protect password:=mypwd End With JTreks wrote: Thanks, Dave. Tried it... I hangs on the ShowAllData line. I know this line is a valid line because the button (macro) works correctly when I do not protect the worksheet. Any idea what else it might be? Thanks "Dave Peterson" wrote: How about adding code to unprotect the sheet, showall the data, then reprotect the worksheet? JTreks wrote: I have a macro attached to a button that is supposed to remove the filter by using the command ShowAllData. As long as I don't protect the worksheet it works fine. As soon as I turn on protection I get a VBA error. Any help here? -- Dave Peterson -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, again, Dave! I swear I did this on my work PC and it didn't work
there but it does here. I'll see what is different about my work PC. Thanks again! BTW, here is my code... Identical to yours except I don't use a PW. Sub Button6_Click() ' ' Button6_Click Macro With ActiveSheet .Unprotect If .FilterMode Then .ShowAllData End If .Protect End With End Sub "Dave Peterson" wrote: It might be best to share the code you tried. But I'd use something like: Dim myPWD as String myPWD = "hi" With Worksheets("somesheethere") 'or ActiveSheet or Me .unprotect password:=mypwd If .FilterMode Then .ShowAllData End If .protect password:=mypwd End With JTreks wrote: Thanks, Dave. Tried it... I hangs on the ShowAllData line. I know this line is a valid line because the button (macro) works correctly when I do not protect the worksheet. Any idea what else it might be? Thanks "Dave Peterson" wrote: How about adding code to unprotect the sheet, showall the data, then reprotect the worksheet? JTreks wrote: I have a macro attached to a button that is supposed to remove the filter by using the command ShowAllData. As long as I don't protect the worksheet it works fine. As soon as I turn on protection I get a VBA error. Any help here? -- Dave Peterson -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This looks like code that's used with a commandbutton from the Control toolbox
toolbar that's placed on that worksheet. Instead of this: With ActiveSheet I'd use: with Me Me is the thing that owns the code--in this case, it's the worksheet with the commandbutton. JTreks wrote: Thanks, again, Dave! I swear I did this on my work PC and it didn't work there but it does here. I'll see what is different about my work PC. Thanks again! BTW, here is my code... Identical to yours except I don't use a PW. Sub Button6_Click() ' ' Button6_Click Macro With ActiveSheet .Unprotect If .FilterMode Then .ShowAllData End If .Protect End With End Sub "Dave Peterson" wrote: It might be best to share the code you tried. But I'd use something like: Dim myPWD as String myPWD = "hi" With Worksheets("somesheethere") 'or ActiveSheet or Me .unprotect password:=mypwd If .FilterMode Then .ShowAllData End If .protect password:=mypwd End With JTreks wrote: Thanks, Dave. Tried it... I hangs on the ShowAllData line. I know this line is a valid line because the button (macro) works correctly when I do not protect the worksheet. Any idea what else it might be? Thanks "Dave Peterson" wrote: How about adding code to unprotect the sheet, showall the data, then reprotect the worksheet? JTreks wrote: I have a macro attached to a button that is supposed to remove the filter by using the command ShowAllData. As long as I don't protect the worksheet it works fine. As soon as I turn on protection I get a VBA error. Any help here? -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problem with funtion ShowAllData | Excel Programming | |||
Troubles with ActiveSheet.ShowAllData | Excel Programming | |||
ShowAllData | Excel Discussion (Misc queries) | |||
ShowAllData in all workbooks and sheets | Excel Programming | |||
vba-showalldata | Excel Programming |