PDA

View Full Version : Solved: Unprotect Sheets while looping through files



kathyb0527
04-14-2009, 03:04 PM
I have a project where I loop through multiple files in a folder, copy data out of the folder and put it in a "master" folder. I've been using test files and have the code working, however, I've just been informed that the cells that I will be copying are protected. My question is if my code doesn't actually "select" the data, do I need to unprotect the sheets. If I do need to unprotect the sheets, how do I do it? The password for all of the worksheets is the same.

As an aside, I just want to thank everyone who adds their expertise to this site. I am learning and being able to search one site for answers has really helped me.

Kathyb

mdmackillop
04-14-2009, 03:47 PM
Hi Kathy,
I don't think you need to unprotect to copy data.

If you need to make changes, then something like

Sheets(1).Unprotect Password:="PW"
Sheets(1).Cells.Copy Sheets(2).Range("A1")
Sheets(1).Protect Password:="PW"