+ Reply to Thread
Results 1 to 7 of 7

Relative Selection based on column to the left

  1. #1
    Registered User
    Join Date
    09-20-2009
    Location
    London, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    7

    Relative Selection based on column to the left

    Hello VBA Experts !

    I searched many sites and found many codes. But couldn't get the code.

    What I want to achieve is this:

    For example, I have 2 Columns, i.e. A and B.

    In Column B, I want to write a formula, which I can. What I want to do is: it should be copied down to the last cell relative to column on the left (which is column A).

    If there are 20 values in cells A1:A20, the formula in B1 should go to B20. If A1 goes up to A100, the formula in B1 should go to A100.

    It's exactly the same as clicking the the fill handle in B1 and it will populate all cells relative to column A until last row of column A.

    What would be the code for this:


    Thanks for your kind help.

  2. #2
    Forum Contributor
    Join Date
    06-07-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Relative Selection based on column to the left

    Try

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-20-2009
    Location
    London, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Relative Selection based on column to the left

    Quote Originally Posted by Thalassa View Post
    Try

    Please Login or Register  to view this content.
    Thanks for the code. Yes it works great.

    Since I specified the cell B1 from which to go down relative to rows in column A.

    How would we refer/change the code if we are in any cell and we want to go down same as above relative to column on left?

    Thanks for your kind help.

  4. #4
    Forum Contributor
    Join Date
    06-07-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Relative Selection based on column to the left

    Perhaps

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-02-2012
    Location
    Bumi Nusantara
    MS-Off Ver
    Excel 2010; Excel 2016
    Posts
    136

    Re: Relative Selection based on column to the left

    For relative cell in every where.. please try this code

    Please Login or Register  to view this content.
    see attached file

  6. #6
    Registered User
    Join Date
    09-20-2009
    Location
    London, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Relative Selection based on column to the left

    WOW ! ! !

    Great! Thanks Thalassa !

    Many many thanks

  7. #7
    Registered User
    Join Date
    09-20-2009
    Location
    London, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Relative Selection based on column to the left

    Thanks for the code Dwint. Its giving an error.

    Thalassa's code is working absolutely fine. Thanks for your kind reply.


+ 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