+ Reply to Thread
Results 1 to 7 of 7

Help with cell reference

  1. #1
    Forum Contributor
    Join Date
    08-09-2006
    Posts
    147

    Help with cell reference

    I know that if you f2 on a cell and f4 it will change the formula cell reference to what I call hard code them.

    ex. $a$1

    I need to know how to write a vba statement to change all whole range.

    example

    Q5:Q48 has formulas like this =SUM(S18:AD18).
    I need them all to be hard coded; like this =SUM($S$18:$AD$18).

    Is there a way to write a vba code for this.

    Thanks
    rlkerr

  2. #2
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394
    This will do it

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525
    Quote Originally Posted by rlkerr
    I know that if you f2 on a cell and f4 it will change the formula cell reference to what I call hard code them.

    ex. $a$1

    I need to know how to write a vba statement to change all whole range.

    example

    Q5:Q48 has formulas like this =SUM(S18:AD18).
    I need them all to be hard coded; like this =SUM($S$18:$AD$18).

    Is there a way to write a vba code for this.

    Thanks
    rlkerr

    You could write the formula like that in the first place.............

    Select the entire range and enter the formula with the absolutes then hit Ctrl enter that should work

  4. #4
    Forum Contributor
    Join Date
    08-09-2006
    Posts
    147

    Unhappy Absolute VBA code

    Mallycat
    The code is giving me an error on the line newformula.

    I just opened my sheet, highlighted the range and ran the macro.

    Did I do something wrong?

  5. #5
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Just type your formula in cell A1 ...
    and then run your macro ...

    HTH
    Carim

  6. #6
    Forum Contributor
    Join Date
    07-13-2006
    Posts
    400
    Quote Originally Posted by Carim
    Hi,

    Just type your formula in cell A1 ...
    and then run your macro ...

    HTH
    Carim
    or alter the code to reflect the range where your formulas are kept

    very good code mallycat, i had looked at this post earlier and ran away screaming, as I had no idea.

    made a very small modification and added it to my personal.xls as

    Please Login or Register  to view this content.
    this just allows you to highlight the range you want converted, then run macro to change to absolute.
    Last edited by MDubbelboer; 11-07-2006 at 12:02 PM.

  7. #7
    Forum Contributor
    Join Date
    08-09-2006
    Posts
    147
    That is great. It works exactly how I wanted it too. Thanks to everyone for helping me out. That saved me about 3 or 4 hours work.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1