Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
JMATHES
 
Posts: n/a
Default Automatically making formulas "Absolute" or "$ Relative"

If you were to type a formula in Cell A1 as follows:
=A2*A3

How do you automatically make this formula a relative formula (meaning add
the $ before and after column and row so it reads $A$2*$A$3) without having
to manually go into the cell and manually type the "$" sign each time?

Is there a way to tell the sheet to make all formulas relative?

  #2   Report Post  
Alan
 
Posts: n/a
Default

This code below in a normal VBA module will do it, you can then select the
range you want to convert and run the appropriate Macro.

Make a backup copy of your file and use the copy to do this,

Highlight and copy the code below,
Open your sheet and go Alt and F11 together to open the VBA editor,
Click 'Insert' on the top toolbar 'Module'
In the new blank window, paste the code in, watch out for text wrap, there
should be eight separate lines of code in each Sub. The text wrap, if any in
the e-mail will be in the line beginning 'Cell.Formula = .......'
Go Alt and F11 again to close the VBA editor,

Save the backup copy of your file,

Highlight the sheet range you want to convert,
Go 'Tools' 'Macro' 'Macros', click the appropriate one and click 'Run'

Regards,
Alan.
PS This code isn't mine, I got it from one of the newsgroups a long time ago
but I cant remember who from. Many thanks whoever you were!


Sub Absolute()
Dim Cell As Range
For Each Cell In Selection
If Cell.HasFormula Then
Cell.Formula = Application.ConvertFormula(Cell.Formula, xlA1, xlA1,
xlAbsolute)
End If
Next
End Sub

Sub AbsoluteRow()
Dim Cell As Range
For Each Cell In Selection
If Cell.HasFormula Then
Cell.Formula = Application.ConvertFormula(Cell.Formula, xlA1, xlA1,
xlAbsRowRelColumn)
End If
Next
End Sub

Sub AbsoluteCol()
Dim Cell As Range
For Each Cell In Selection
If Cell.HasFormula Then
Cell.Formula = Application.ConvertFormula(Cell.Formula, xlA1, xlA1,
xlRelRowAbsColumn)
End If
Next
End Sub

Sub Relative()
Dim Cell As Range
For Each Cell In Selection
If Cell.HasFormula Then
Cell.Formula = Application.ConvertFormula(Cell.Formula, xlA1, xlA1,
xlRelative)
End If
Next
End Sub

"JMATHES" wrote in message
...
If you were to type a formula in Cell A1 as follows:
=A2*A3

How do you automatically make this formula a relative formula (meaning add
the $ before and after column and row so it reads $A$2*$A$3) without
having
to manually go into the cell and manually type the "$" sign each time?

Is there a way to tell the sheet to make all formulas relative?



  #3   Report Post  
Mike R
 
Posts: n/a
Default

You can use f4 and it will allow you to toggle through all aspects of
"absolute" for the selected cell.

Mike Rogers

"JMATHES" wrote:

If you were to type a formula in Cell A1 as follows:
=A2*A3

How do you automatically make this formula a relative formula (meaning add
the $ before and after column and row so it reads $A$2*$A$3) without having
to manually go into the cell and manually type the "$" sign each time?

Is there a way to tell the sheet to make all formulas relative?

  #4   Report Post  
RagDyer
 
Posts: n/a
Default

After you finish entering the formula, you can select the *entire* formula
in the formula bar, and then hit <F4, and you'll change the *entire*
formula to absolute with just that *one* hit of <F4.
--
HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"Mike R" wrote in message
...
You can use f4 and it will allow you to toggle through all aspects of
"absolute" for the selected cell.

Mike Rogers

"JMATHES" wrote:

If you were to type a formula in Cell A1 as follows:
=A2*A3

How do you automatically make this formula a relative formula (meaning

add
the $ before and after column and row so it reads $A$2*$A$3) without

having
to manually go into the cell and manually type the "$" sign each time?

Is there a way to tell the sheet to make all formulas relative?


  #5   Report Post  
Excel_Geek
 
Posts: n/a
Default


When you're inputting the "=A1" (or whatever reference), you can hit the
F4 key and it will add the $s. Hit it again, and it will move through
all the variations you can have -- i.e. $A1, A$1, A1, $A$1, etc.

If you're inputing a formula like "=A1*A2", immediately after typing
(or clicking the) A1 is when you'd hit the F4 key to add $s to the A1.
After typing (or clicking the) A2, is when you hit the F4 key for it.


--
Excel_Geek


------------------------------------------------------------------------
Excel_Geek's Profile: http://www.excelforum.com/member.php...o&userid=26423
View this thread: http://www.excelforum.com/showthread...hreadid=399616



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making multiple cells absolute at once Jamie A Miller Excel Discussion (Misc queries) 2 May 25th 05 01:13 AM
Trouble with making a 3D reference absolute Sherry Excel Discussion (Misc queries) 1 March 24th 05 09:28 PM
stop automatically making email address lily Excel Discussion (Misc queries) 1 March 23rd 05 04:53 AM
how can i calculate formulas automatically Seige Silver Excel Discussion (Misc queries) 3 March 7th 05 02:15 PM
Automatically 'incrementing' formulas for new rows. MediaScribe New Users to Excel 3 February 21st 05 06:29 PM


All times are GMT +1. The time now is 03:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"