+ Reply to Thread
Results 1 to 3 of 3

Macro - wrong column reference

  1. #1
    Registered User
    Join Date
    03-14-2007
    Posts
    32

    Macro - wrong column reference

    Hi,

    I've recorded a macro to do a simply subtraction of two cells (Column E - Column F). I used the option for "relative references" when recording the macro, and this works correctly for the following rows.
    The problem I have is that I need to execute this macro in a number of possible columns, however the macro seem to record the "distance" from the columns where it should perform the subtraction. As a result it won't work when it try and execute in a different column to the one where it originally recorded the macro.

    How can I change the macro so that performs the subtraction for columns E and F, regardless of which column I execute the macro in?

    Current macro code is as follows:

    Please Login or Register  to view this content.
    Thank you for your help.
    Steve.

  2. #2
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: Macro - wrong column reference

    You need to use Absolute reference for the columns, not the rows. For columns E and F
    Please Login or Register  to view this content.
    Notice the [ ] - this is a relative reference - omit these for absolute references
    See this link http://office.microsoft.com/en-us/he...005198323.aspx
    Last edited by smuzoen; 02-04-2012 at 10:58 PM.
    Hope this helps.
    Anthony
    Pack my box with five dozen liquor jugs
    PS: Remember to mark your questions as Solved once you are satisfied. Please rate the answer(s) by selecting the Star in the lower left next to the Triangle. It is appreciated?

  3. #3
    Registered User
    Join Date
    03-14-2007
    Posts
    32

    Re: Macro - wrong column reference

    Thanks a lot!

+ 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