2
votes

I have a macro that's using a loop to take data from one sheet and copy it to another, putting them in an order determined by an array. Relevant code:

For counter = 1 To 358 Step 1
    Sheets("data").Cells(inputrow, counter + 1) = Sheets("Sheet1").Cells(rowarray(counter), colarray(counter))
    Sheets("sheet1").Cells(rowarray(counter), colarray(counter)).Clear
Next counter

The input sheet is protected, with the cells that you put data unlocked, but every time I run the macro those cells get locked again. I have no idea what's causing this and it's driving me nuts. Please help!

1

1 Answers

3
votes

.Clear was stripping the unlocked formatting. Use .ClearContents instead.