Module to make all absolute references relative

G

Guest

I'm using absolute references to allow a set of formulas to be copied across
and down a spreadsheet with only certain values changing relatively. After
the formulas are in place, I need all absolute references to be returned to
relative references so the sheet will still function when it is reformatted,
parts added/removed etc...

Couldn't a simple module be written to remove all "$" characters from cells
in the sheet?
 
P

Peter T

Probably just as quick to do a manual search & replace-all (ctrl-h) in Excel
as would be to find and run a macro. Or record a macro while you do that.

Regards,
Peter T
 
B

Bob Phillips

Dim cell As Range
For Each cell In ActiveSheet.UsedRange
If cell.HasFormula Then
cell.Formula = Application.ConvertFormula(cell.Formula, xlA1, ,
xlRelative)
End If
Next cell


--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 
G

Guest

Thanks, that's great.

Bob Phillips said:
Dim cell As Range
For Each cell In ActiveSheet.UsedRange
If cell.HasFormula Then
cell.Formula = Application.ConvertFormula(cell.Formula, xlA1, ,
xlRelative)
End If
Next cell


--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 

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

Top