Hi, I'm new to Excel VBA.. All I did was copy paste code from internet & edit.. I'm trying to make sheet visible by username only but the code below gives me error Object variable not set. please help
Private Sub Initialize()
Dim ws As Worksheets
NAMA = Application.UserName
If NAMA = "Tiva" Then
GoTo SCM
Else
GoTo STARTUP
End If
STARTUP:
ws(Sheet1).Visible = x1sheetvisible
SCM:
ws(Sheet1).Visible = x1SheetHidden
ws.Visible = xlSheetVisible
MsgBox "Hello " & NAMA
End Sub
Private Sub Initialize()
Dim ws As Worksheets
NAMA = Application.UserName
If NAMA = "Tiva" Then
GoTo SCM
Else
GoTo STARTUP
End If
STARTUP:
ws(Sheet1).Visible = x1sheetvisible
SCM:
ws(Sheet1).Visible = x1SheetHidden
ws.Visible = xlSheetVisible
MsgBox "Hello " & NAMA
End Sub