Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default ShowAllData doesn't work with Protection

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default ShowAllData doesn't work with Protection

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default ShowAllData doesn't work with Protection

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default ShowAllData doesn't work with Protection

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default ShowAllData doesn't work with Protection

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default ShowAllData doesn't work with Protection

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with funtion ShowAllData oscar_acm Excel Programming 0 August 11th 06 12:04 AM
Troubles with ActiveSheet.ShowAllData [email protected] Excel Programming 3 June 1st 06 02:50 PM
ShowAllData Pat Excel Discussion (Misc queries) 3 April 14th 05 10:08 PM
ShowAllData in all workbooks and sheets Robert Christie[_3_] Excel Programming 2 January 29th 05 03:29 PM
vba-showalldata chick-racer[_45_] Excel Programming 7 December 5th 03 09:00 PM


All times are GMT +1. The time now is 02:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"