+ Reply to Thread
Results 1 to 11 of 11

VBA to recognize active cell and total rows

  1. #1
    Registered User
    Join Date
    02-14-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    20

    VBA to recognize active cell and total rows

    What I'd like is, the macro will apply to the cell to the right of whatever my active cell is. For example, the column may not be B, it may be H, or I. Also, only copy down as far as the there are filled cells in the rows. So, one sheet there may be 10 rows, another there may be 200 rows.

    Is there a way to adjust this macro to do that?

    Thanks.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA to recognize active cell and total rows

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    02-14-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: VBA to recognize active cell and total rows

    I've attached the sheet. Does this help?
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    02-14-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: VBA to recognize active cell and total rows

    Anyone have the opportunity to check this out? Thanks.

  5. #5
    Registered User
    Join Date
    02-14-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: VBA to recognize active cell and total rows

    I've been messing a bit more with it. You can see where I'm stuck...


    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    07-29-2008
    Location
    New York
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    145

    Re: VBA to recognize active cell and total rows

    Just_some_dude,

    It is a bit difficult for me to work with moving tagets, but maybe someone can improve on this.

    Place this macro in a module, and see if it works for the sheet named "Try the Macro here"

    Please Login or Register  to view this content.
    Regards,
    Xrull
    Last edited by Xrull; 03-21-2011 at 03:05 PM.

  7. #7
    Registered User
    Join Date
    02-14-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: VBA to recognize active cell and total rows

    Well, how about this... Is there any way to autofill down to the last row, but only specific to the selection made? For example, I've gotten to the point where it selects the three cells I need to copy down, but now I need to autofill to the last row. I don't what to specify which columns are going to be copied down, just the selection made.

  8. #8
    Forum Contributor
    Join Date
    07-29-2008
    Location
    New York
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    145

    Re: VBA to recognize active cell and total rows

    Just_some_dude,
    Try this:
    Please Login or Register  to view this content.
    Regards,
    Xrull
    Last edited by Xrull; 03-22-2011 at 07:34 PM.

  9. #9
    Forum Contributor
    Join Date
    07-29-2008
    Location
    New York
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    145

    Re: VBA to recognize active cell and total rows

    Just_some_dude,
    I think this code will process to the last cell selected:

    Please Login or Register  to view this content.
    Regards,
    Xrull

  10. #10
    Registered User
    Join Date
    02-14-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: VBA to recognize active cell and total rows

    Thanks a lot Xrull. That's pretty much what I needed. I made a few changes and need to figure out a few things. Now, when I run this macro it adds one extra cell to the bottom of the list. Basically, it goes one row beyond the last row.



    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    07-29-2008
    Location
    New York
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    145

    Re: VBA to recognize active cell and total rows

    Just_some_dude,
    Try this one:
    Please Login or Register  to view this content.
    This one is better because you don't have to select the cells:

    Please Login or Register  to view this content.
    Regards,
    Xrull
    Last edited by Xrull; 03-23-2011 at 06:07 PM.

+ 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