Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lock a Group of formulas

Status
Not open for further replies.

PhilMyWallet

Technical User
Feb 20, 2002
84
GB
I have a column of formulas (all different) which reference a seperate worksheet. I need to copy all the formulas in the column and paste them into a seperate column but keeping the same referenced cells.

I understand I can lock the formulas individually, however there are 432 formulas to lock.

Is there any way I can lock the lot in one go?


Regards



Phil
 
Do you need to keep the original formulas? If not cutting rather than copying will retain the reference to the precedent cells.

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
if I copy & paste the formula (Sum(C1:C2)) from column a to column b then the formula changes to Sum(D1:D2).

I need the formula to show (Sum(C1:C2)) after it has been copied, however I need to do this for over 400 formulas (in one column), so I need to lock all the formulas before copying them. Can I lock them all at once?

Hope this makes sense.


Phil
 
I repeat my question
Do you need to keep your formulas in column A after copying them to column B?

If you don't then you could CUT the formulas and PASTE them rather than using COPY.

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
I need to copy them, however even if I cut them I would still be in the same situation, as it would still move the reference on by one cell to the right.

Any other thoughts

 
PhilMyWallet,
use $ signs in front of column letters and row numbers to lock the formula to specific cells, so (SUM($C$1:$C$2))


Stubnski
 
PhilMyWallet said:
even if I cut them I would still be in the same situation, as it would still move the reference on by one cell to the right

Um, no it wouldn't. Unless Excel 10, 11 & the upcoming 12 are drastically different!

Anyway here's a possible solution to your dilema. This doesn't "lock" the formulas but will effectively copy the same formulas to a column 5 columns over.

Code:
Sub standard()
Dim c As Range
For Each c In Range("f1:f30")'change to your range
    c.Offset(0, 5) = c.Formula 'change num of cols over
Next
End Sub


;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
I can't beleive I have been using excel for 10 years & I didn't know that cutting and pasting would keep the formulas static.

Now I know this I have found an alternitive solution :

Copy the full column into a sperate sheet on the same workbook making sure I copy into the same column on the new worksheet.

Cut the column and paste into the column I required (keeping it in the new worksheet).

Copy & paste into the working worksheet. (then delete new worksheet)

Bingo !!!!!

Thank you all for your help !!!!
 
if I copy & paste the formula (Sum(C1:C2)) from column a to column b then the formula changes to Sum(D1:D2).

I need the formula to show (Sum(C1:C2)) after it has been copied, however I need to do this for over 400 formulas (in one column), so I need to lock all the formulas before copying them. Can I lock them all at once?
You can use Find and Replace on Column A, using the following criteria and Replace All:

FindAndReplace.jpg


then copy and paste to Column B.
 
Thought of that one too. As my references were over several columns on each formula, it would have taken me just as long to do it that way.

The cut and paste solution worked ok though.


Thanks anyway


Phil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top