G
Guest
I'm still a beginner at this, so would appreciate an expert explaining what
is going on here. My Workook_Open macro (follows) was not running at all.
----------------------
Private Sub Workbook_Open()
Sheets("Audit").Select
If Range("E2").Value = "New" Then
Range("A2").Value = Application.UserName
Range("B2").Value = Date
Range("C2").Value = Time
Randomize
Range("D2").Value = Rnd()
ActiveSheet.Protect Password:="A" & Int(Rnd() * 10000000000#)
ActiveSheet.Visible = False
End If
Sheets("Profiles").Select
End Sub
----------------------
I added the following lines to the macro to try and see why
----------------------
If Range("E2").Value <> "New" Then
Range("A2").Value = Application.UserName
End If
----------------------
and suddenly it did work, even though the code itself should not have
resulted in any difference. Is there some compilation step that I'm
overlooking? This macro is going to get recycled into several different
spreadsheets and I need to document how to make it work for future
maintainers.
Many thanks,
Geoff.
is going on here. My Workook_Open macro (follows) was not running at all.
----------------------
Private Sub Workbook_Open()
Sheets("Audit").Select
If Range("E2").Value = "New" Then
Range("A2").Value = Application.UserName
Range("B2").Value = Date
Range("C2").Value = Time
Randomize
Range("D2").Value = Rnd()
ActiveSheet.Protect Password:="A" & Int(Rnd() * 10000000000#)
ActiveSheet.Visible = False
End If
Sheets("Profiles").Select
End Sub
----------------------
I added the following lines to the macro to try and see why
----------------------
If Range("E2").Value <> "New" Then
Range("A2").Value = Application.UserName
End If
----------------------
and suddenly it did work, even though the code itself should not have
resulted in any difference. Is there some compilation step that I'm
overlooking? This macro is going to get recycled into several different
spreadsheets and I need to document how to make it work for future
maintainers.
Many thanks,
Geoff.