Protecting Sheet with Password

  • Thread starter Thread starter halem2
  • Start date Start date
H

halem2

Hi:

I have a sheet that I copy and past with a macro. The original shee
is protected with a password but when the macro copies and pastes int
another sheet, it is no longer protected.

Is there a way to pass a password to protect the new sheet???


thanks
 
Couldn't you just password protect it after you did the paste?

Or do you mean you want to use the same password--and it's not available to you?
 
the spreadsheet will be used by 15 different users in 15 differen
geographical locations. I'm trying to avoid having any of them chang
the sheet. I am the one passwording the sheet
 
If you're the one applying the password and writing the code, then you should be
able do your stuff and protect the worksheet.

dim wks1 as worksheet
dim wks2 as worksheet

set wks1 = worksheets("sheet1")
set wks2 = worksheets("sheet2")

wks1.range("a1:b9").copy _
destination:=wks2.range("a1")

wks2.protect password:="hi"

I guess you didn't even need to unprotect your original worksheet to copy the
data.

(I misunderstood that portion of your question.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top