What is wrong with my code?

kangaruz

Board Regular
Joined
Apr 6, 2007
Messages
56
Hi Guys,
I'm having a bad time with this code. This code is activated when my workbook is opened. Userform4 is a :username and password" entry form and Userform3 is a userform splash screen that closes after 5 seconds.When i open the workbook and the correct username and password is entered,the splash screen appears and closes, I get and run-time error 57121 and the line " Sheets("Log Book").Visible = True" is highlighted in my macro.
Any help would be appreciated,
Thanks

Code:
Private Sub Workbook_Open()
UserForm4.Show
UserForm3.Show
Sheets("Log Book").Visible = True
Sheets("Log Book").Select
Sheets("Log Book").Unprotect
EndRow = Sheets("Log Book").Range("A65536").End(xlUp).Row + 1
NextNum = Sheets("Log Book").Range("A" & EndRow - 1).Value + 1
Sheets("Log Book").Range("A" & EndRow).Value = NextNum
Sheets("Log Book").Range("B" & EndRow).Value = Environ("USERNAME")
Sheets("Log Book").Range("C" & EndRow).Value = Application.UserName
Sheets("Log Book").Range("D" & EndRow).Value = Now()
Range("c500").End(xlUp).Select
Sheets("Log Book").Visible = True
Sheets("Config").Visible = True
Sheets("Config").Select
Range("C1").Select
Selection.Copy
Sheets("Log Book").Select
Sheets("Log Book").Range("E500").End(xlUp).Select
ActiveCell.Offset(1, 0).Select
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
        xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Config").Visible = False
Sheets("Log Book").Visible = False
Sheets("HomePage").Activate
End Sub
 
Last edited by a moderator:

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,203,435
Messages
6,055,353
Members
444,781
Latest member
rishivar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top