+ Reply to Thread
Results 1 to 4 of 4

Unintended cell reference updates when running macro

  1. #1
    Registered User
    Join Date
    01-08-2011
    Location
    Marlboro, MA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Unintended cell reference updates when running macro

    Hi,

    I want to add the Excel ROUND function to numerous existing cells on multiple worksheets and using find/replace will not work (as far as I know) as I would need to make two passes to add "ROUND(" to the front of the existing formula and ",0)" to the tail end of the formula (Excel complains/rejects the first update indicating the formula is inconsistent). So, I tried creating a macro that does both parts at once by finding a keyword at the front of the formula, replacing it to add the "ROUND(" text, and then going to the end of the formula to add the ",0)" portion. But, when I run the macro, it ends up with an unintended result of also converting cell references in the formula as they do not use the '$' feature. There must be an easy way to accomplish what I want to do other than editing each cell and would appreciate hearing of a way(s) to perform this task.

    Thanks,
    Nick
    Last edited by NickBach; 05-27-2011 at 07:36 AM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Unintended cell reference updates when running macro

    Can we see your code?

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Unintended cell reference updates when running macro

    This would be how I would do it:

    Please Login or Register  to view this content.

    Dom

  4. #4
    Registered User
    Join Date
    01-08-2011
    Location
    Marlboro, MA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Unintended cell reference updates when running macro

    Dom,

    Your suggestion did the trick. Thanks a lot to you (and to this forum) for the super quick responce that seems to get posted. There's a lot of 'smarts' in this forum.

    Thanks again - saved me several hours of effort,
    Nick

+ 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