Thread: Worksheet name
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Anthony Anthony is offline
external usenet poster
 
Posts: 275
Default Worksheet name

Hi,
Hope someone can help.
I created a form and has a text box in it. User key in the name of the
worksheet in the text box but I stumble upon a compile error. My code is as
below

Private Sub cmdUpdate_Click()
Dim fname, ws1 As String
Dim ws As Worksheet
fname = txtFileName

Workbooks.Open fname
Set ws = txtWorksheet
If ws = "" Then
MsgBox "Please input name of Worksheet"
End If
Call Module1.CopyPrice(ws, 4)

End Sub