copy sheets
I have this excel file that I have created. I wanted to set it up to be multi-user friendly. So essentially what i have done was at startup, i ask for a user name and password. Then the code runs through a worksheet and checks for user name and password. If the password cannot be verified it copies a worksheet for the user to fill out. But for some reason I keep getting an error on the copy worksheet routine. Here is the code:
Private Sub CopySheets()
Dim wsh As Worksheet
ActiveWorkbook.Sheets("SRC").Copy _
After:=ActiveWorkbook.Sheets(ActiveWorkbook.Sheets .Count)
Set wsh = ActiveSheet
wsh.Name = userName & " SRC"
The error im getting is a Run-time error '1004', Application-defined or object-defined error.
I have tried using the code several different ways but I have not been able to get it to work. Can anyone give me a reccomendation?
|