+ Reply to Thread
Results 1 to 6 of 6

How can I change this code to fill to the last cell with data in it?

  1. #1
    Valued Forum Contributor
    Join Date
    04-11-2006
    MS-Off Ver
    2007
    Posts
    438

    How can I change this code to fill to the last cell with data in it?

    2 Questions here...(Entire macro is at the bottom)

    QUESTION 1 - In line 4 of the code below, in Column B, how can I get this code to auto-fill ONLY equal to the bottom-most row with any data in column A?
    Note that it's never exactly "B254"



    QUESTION 2 - How can I change these 3 lines of code...

    Please Login or Register  to view this content.
    Instead of selecting the whole column, I would like to ONLY select, copy and paste the cells in that column with data in them BUT NOT the whole column?



    Here's ALL the code...

    Please Login or Register  to view this content.

    Thanks much
    Last edited by duugg; 06-10-2009 at 12:50 PM.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: How can I change this code to fill to the last cell with data in it?

    Select or Selection is seldom needed.
    Please Login or Register  to view this content.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How can I change this code to fill to the last cell with data in it?

    Maybe like this, no need to autofill if we've already spotted the lastrow, we can insert data in the whole range all at once:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Valued Forum Contributor
    Join Date
    04-11-2006
    MS-Off Ver
    2007
    Posts
    438

    Re: How can I change this code to fill to the last cell with data in it?

    Kenneth,

    Thanks for the reply but this line of code

    Please Login or Register  to view this content.
    started the autofill on row 1, the Title row. How can I have it autofill, starting at row 2?

    Thanks

  5. #5
    Valued Forum Contributor
    Join Date
    04-11-2006
    MS-Off Ver
    2007
    Posts
    438

    Re: How can I change this code to fill to the last cell with data in it?

    O M G

    I believe you are a rocket scientist!

    It's amazing how much you can do with very little code!

    Worked perfectly!

    Thanks to both of you

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How can I change this code to fill to the last cell with data in it?

    Well, they're little rockets, but they count! Glad to help...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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