+ Reply to Thread
Results 1 to 9 of 9

Macros for Autofill( click & drag)- Acticv cell to last row by its side

  1. #1
    Registered User
    Join Date
    09-01-2012
    Location
    Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    5

    Macros for Autofill( click & drag)- Acticv cell to last row by its side

    Hello Friends,

    I just joined today and need some help...

    I am writing a macros for a challenging excel format....
    My solution is based on cell movements
    however i am facing a road block when i try and click and drag from the active cell that i have landed on to the last column beside it

    Selection.Offset(0, 3).Select
    click and drag till last cell beside it may vary

    e.g

    A B
    8/9/2012 Active cell where i am.... may not necessarily be B1 could be any permutation the same goes for column A
    7/31/2012
    7/28/2012
    8/7/2012
    8/8/2012



    Thanks,

    Prithviraj

  2. #2
    Registered User
    Join Date
    09-01-2012
    Location
    Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Macros for Autofill( click & drag)- Acticv cell to last row by its side

    A1 8/9/2012 B1 Active cell where i am.... may not necessarily be B1 could be any permutation the same goes for column A
    A2 7/31/2012
    A3 7/28/2012
    A4 8/7/2012
    A5 8/8/2012


    made a change to how it might look like


    Thanks in advance to everyone,

    Prithviraj
    Last edited by prithvirajsethi; 09-01-2012 at 02:06 PM.

  3. #3
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Macros for Autofill( click & drag)- Acticv cell to last row by its side

    Do you mean something like

    Please Login or Register  to view this content.
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  4. #4
    Registered User
    Join Date
    09-01-2012
    Location
    Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Macros for Autofill( click & drag)- Acticv cell to last row by its side

    Hi Was,

    Thanks for your speedy response...
    i did try ur code howver it fills 'All' the cells beside it
    what i am really trying to do is use it like a simple click and drag where the tool would understand where to stop basis the data on its left

    for.e.g if all cells are pouplated from a1 to a65 then the code drags b1 till b65
    please note that my cell position would change basis the data...Thanks

  5. #5
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Macros for Autofill( click & drag)- Acticv cell to last row by its side

    Sorry I am a little confused as when I run the code on data like below with B1 as the ActiveCell


    A B
    1 1 z
    2 1
    3 1
    4 1
    5 1
    6
    7
    8
    9
    10
    11


    It only fills to B5. Is your data laid out differently?



    A B
    1 1 z
    2 1 z
    3 1 z
    4 1 z
    5 1 z
    6
    7
    8
    9
    10
    11

    Edit: The image didn't come out properly. Column A is the column with all the 1's and Column B has the Z's
    Last edited by WasWodge; 09-01-2012 at 02:55 PM.

  6. #6
    Registered User
    Join Date
    09-01-2012
    Location
    Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Macros for Autofill( click & drag)- Acticv cell to last row by its side

    yes ...slight difference there could be a blank cell and then data again in Row A
    the code should only read till the last row till the break...thats A11 in this e.g.

    A B
    1 1 z
    2 1 z
    3 1 z
    4 1 z
    5 1 z
    6 1 z
    7 1 z
    8 1 z
    9 1 z
    10 1 z
    11 1 z


    14
    15
    16

    Thanks again

  7. #7
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Macros for Autofill( click & drag)- Acticv cell to last row by its side

    OK, change it to


    Please Login or Register  to view this content.
    But beware it is untested as typed it on my phone

  8. #8
    Registered User
    Join Date
    09-01-2012
    Location
    Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Macros for Autofill( click & drag)- Acticv cell to last row by its side

    Thanks mate... appreciate all ur help and time...
    The Was code is good for users who may try it nxt.....

    Have a good one... Cheers...

  9. #9
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Macros for Autofill( click & drag)- Acticv cell to last row by its side

    Your Welcome

+ 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