ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hidden worksheet (https://www.excelbanter.com/excel-programming/301331-hidden-worksheet.html)

Patrick Simonds

Hidden worksheet
 
Why wont the following code work on a hidden worksheet? UserForm2 will be
used to place data on the hidden worksheet.


Private Sub CommandButton1_Click()
Unload UserForm3
Sheets("Engraving Jobs").Select
Range("A1").Select
UserForm2.Show
'Module3.Fill_ID_Down
End Sub



Tom Ogilvy

Hidden worksheet
 
You can't select a hidden worksheet, but you don't need to

Private Sub CommandButton1_Click()
Unload UserForm3
UserForm2.Show
Module3.Fill_ID_Down Sheets("Engraving Jobs")
End Sub

Change the Fill_ID_Down code to accept a worksheet reference and work with
that sheet without selecting it.

--
Regards,
Tom Ogilvy


"Patrick Simonds" wrote in message
...
Why wont the following code work on a hidden worksheet? UserForm2 will be
used to place data on the hidden worksheet.


Private Sub CommandButton1_Click()
Unload UserForm3
Sheets("Engraving Jobs").Select
Range("A1").Select
UserForm2.Show
'Module3.Fill_ID_Down
End Sub





Patrick Simonds

Hidden worksheet
 
I am afraid you lost me. I entered the code as you suggested but I get the
following error "compile error wrong number of arguments or invalid
property assignment" and when I click on debug .Fill_ID_Down Sheets (of
the line Module3.Fill_ID_Down Sheets("Engraving Jobs")) is highlighted.

You also mentioned Changing the Fill_ID_Down code to accept a worksheet
reference and work with that sheet without selecting it. Below is the Sub
Fill_ID_Down() and it does not reference the worksheet.


Sub Fill_ID_Down()
'
' Fill ID down Macro

Range("A" & Rows.Count).End(xlUp).AutoFill _
Destination:=Range("A" & Rows.Count).End(xlUp).Resize(2)

End Sub

End Sub
"Tom Ogilvy" wrote in message
...
You can't select a hidden worksheet, but you don't need to

Private Sub CommandButton1_Click()
Unload UserForm3
UserForm2.Show
Module3.Fill_ID_Down Sheets("Engraving Jobs")
End Sub

Change the Fill_ID_Down code to accept a worksheet reference and work with
that sheet without selecting it.

--
Regards,
Tom Ogilvy


"Patrick Simonds" wrote in message
...
Why wont the following code work on a hidden worksheet? UserForm2 will

be
used to place data on the hidden worksheet.


Private Sub CommandButton1_Click()
Unload UserForm3
Sheets("Engraving Jobs").Select
Range("A1").Select
UserForm2.Show
'Module3.Fill_ID_Down
End Sub







Tom Ogilvy

Hidden worksheet
 
You get the error because you didn't modify Fill_ID_Down

Sub Fill_ID_Down(wks as Variant)
'
' Fill ID down Macro

With wks
.Range("A" & .Rows.Count).End(xlUp).AutoFill _
Destination:=.Range("A" & .Rows.Count).End(xlUp).Resize(2)
End with

End Sub

--
Regards,
Tom Ogilvy


"Patrick Simonds" wrote in message
...
I am afraid you lost me. I entered the code as you suggested but I get the
following error "compile error wrong number of arguments or invalid
property assignment" and when I click on debug .Fill_ID_Down Sheets (of
the line Module3.Fill_ID_Down Sheets("Engraving Jobs")) is highlighted.

You also mentioned Changing the Fill_ID_Down code to accept a worksheet
reference and work with that sheet without selecting it. Below is the Sub
Fill_ID_Down() and it does not reference the worksheet.


Sub Fill_ID_Down()
'
' Fill ID down Macro

Range("A" & Rows.Count).End(xlUp).AutoFill _
Destination:=Range("A" & Rows.Count).End(xlUp).Resize(2)

End Sub

End Sub
"Tom Ogilvy" wrote in message
...
You can't select a hidden worksheet, but you don't need to

Private Sub CommandButton1_Click()
Unload UserForm3
UserForm2.Show
Module3.Fill_ID_Down Sheets("Engraving Jobs")
End Sub

Change the Fill_ID_Down code to accept a worksheet reference and work

with
that sheet without selecting it.

--
Regards,
Tom Ogilvy


"Patrick Simonds" wrote in message
...
Why wont the following code work on a hidden worksheet? UserForm2 will

be
used to place data on the hidden worksheet.


Private Sub CommandButton1_Click()
Unload UserForm3
Sheets("Engraving Jobs").Select
Range("A1").Select
UserForm2.Show
'Module3.Fill_ID_Down
End Sub










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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com