Thread: Show all data
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Show all data

So commandbutton1 is on Sheet1?

If yes:

Private Sub CommandButton1_Click()
with me
.Unprotect
If .FilterMode Then
.ShowAllData
End If
.range("a1").select
.protect
end with
Sheet7.select
worksheets("Menu").commandbutton3.visible = true
end sub

Is there any reason you used the codename for Sheet7, but worksheets("menu") for
the visible statement?

If Sheet1 is not the sheet with the button:


Private Sub CommandButton1_Click()
with Sheet1
.Unprotect
If .FilterMode Then
.ShowAllData
End If
.select 'need to select the sheet before selecting a range
.range("a1").select
.protect
end with
Sheet7.select
worksheets("Menu").commandbutton3.visible = true
end sub


WH99 wrote:

I have a search facility which filters the data, That works ok, but when I
press commandbutton1 (code below) it should show all data and change to
sheet7. I get an error code 1004 and the following is highlighted
"Sheet1.ShowAllData".
Any ideas?

Option Explicit

Private Sub CommandButton1_Click()
Sheet1.Unprotect
Sheet1.ShowAllData
Cells.Range("A1").Select
Sheet1.Protect
Sheet7.Select
Worksheets("menu").CommandButton3.Visible = True
End Sub
--
WH99


--

Dave Peterson