I'm having trouble with assigning a worksheet reference, then passing that to a sub. In the sample below I use two different ways to identify the worksheet that I want to format. I can't figure out the difference between passing the reference to the worksheet versus its name.
Thanks in advance!
Thanks in advance!
Code:
[INDENT]Sub fmtDate_Sputter1(ws As Worksheet)
'
ws.Range("C:C").NumberFormat = "yyyy-mmm-dd, hh:mm:ss"
End Sub
Sub fmtDate_Sputter2(wsname As String)
'
Worksheets(wsname).Range("C:C").NumberFormat = "yyyy-mmm-dd, hh:mm:ss"
End Sub
Sub Foo23()
' test driver for fmtDate_Sputter()
Dim wsCycles As Worksheet
strCycleSheetName = "cycle"
Set wsCycles = Worksheets(strCycleSheetName)
'Set wsCycles = Sheets(strCycleSheetName)
fmtDate_Sputter1 (wsCycles) ' err 438: no support method / property
fmtDate_Sputter1 (Worksheets(strCycleSheetName)) ' err 438: no support method / property
fmtDate_Sputter2 (strCycleSheetName) ' works
End Sub
[/INDENT]