Question : Set Worksheet name

Hi Experts,

I need Experts help. How to set the worksheet name in attached script? The Worksheet name is "system".

1:
2:
3:
4:
5:
6:
7:
8:
Hi Sub Time()
Dim cel As Range
For Each cel In Range("B2", Cells(Rows.Count, "B").End(xlUp))
    cel.Value = Val(cel.Value)
    cel.NumberFormat = "00\:00\:00\:00"
    cel.Value = cel.Text
Next cel
End Sub

Answer : Set Worksheet name

Forget former post, this is good

Hi Sub Time()
Dim myWB as Workbook
Dim myWS as Worksheet
Dim cel As Range
Set myWB = Workbooks("Name.xls")
Set myWS = myWB.Worksheets("Sheet1")
For Each cel In MyWS.Range("B2", myWS.Cells(Rows.Count, "B").End(xlUp))
    cel.Value = Val(cel.Value)
    cel.NumberFormat = "00\:00\:00\:00"
    cel.Value = cel.Text
Next cel
End Sub
Random Solutions  
 
programming4us programming4us