+ Reply to Thread
Results 1 to 17 of 17

How to copy column until blank VBA?

  1. #1
    Forum Contributor
    Join Date
    02-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    110

    How to copy column until blank VBA?

    Hello,

    I'm trying to write a vba code to say:


    In sheet "ADI MMS" copy all the data from F2 until "Blank" as value only.


    Your help is greatly appreciated.
    Thank you.
    Last edited by clprdctn; 03-13-2014 at 03:54 PM.

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: How to copy column until blank VBA?

    Hello,

    Like this?

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: How to copy column until blank VBA?

    I assume that when you say
    copy all the data from F2 until "Blank"
    you mean all the data in column F starting at row 2. Is that correct? Once you copy the range value, what do you want to do with it?
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Forum Contributor
    Join Date
    02-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: How to copy column until blank VBA?

    Sorry GC, It's my mistake I should've explained better.

    Hi Mumps,

    From Cell "F2" all the way down (Always on Column F) until Blank. And all I need to copy the data to the clipboard.

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to copy column until blank VBA?

    If refering to across Columns then maybe:

    Please Login or Register  to view this content.
    Otherwise, ignore this post.

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: How to copy column until blank VBA?

    I don't know if there is a way that you can copy only the values. Normally what is done is that you copy the range in question and then you can paste the values only using 'xlPasteValues'.

  7. #7
    Forum Contributor
    Join Date
    02-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: How to copy column until blank VBA?

    Okay, I can work around that later but is there a code to copy the data to clipboard for this?

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: How to copy column until blank VBA?

    Try:
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    02-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: How to copy column until blank VBA?

    I got:

    Run-Time Error '91'

    Object variable or with block variable not set.

  10. #10
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: How to copy column until blank VBA?

    Which line was highlighted?

  11. #11
    Forum Contributor
    Join Date
    02-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: How to copy column until blank VBA?

    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

  12. #12
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: How to copy column until blank VBA?

    That is strange since it is simply looking for the last used cell in your sheet. As long your sheet is not blank, it should work.

  13. #13
    Forum Contributor
    Join Date
    02-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: How to copy column until blank VBA?

    What do I add to this to say select sheet ADI MMS?

  14. #14
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: How to copy column until blank VBA?

    This will copy the range from the sheet "ADI MMS".
    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    02-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: How to copy column until blank VBA?

    Still getting the same error with same highlighted area.

  16. #16
    Forum Contributor
    Join Date
    02-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: How to copy column until blank VBA?

    I got this to work:

    Please Login or Register  to view this content.

  17. #17
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: How to copy column until blank VBA?

    Glad it worked out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 6
    Last Post: 01-08-2014, 01:56 PM
  2. copy column and it's row value till column blank found
    By nareshkt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2013, 03:20 AM
  3. [SOLVED] Macro to copy columns and paste into one column in next blank column
    By rmmohan in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-31-2013, 03:14 PM
  4. Copy Data from Column and Paste to Next Blank Column on 2nd Sheet
    By adammark in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-19-2010, 11:15 AM
  5. Copy nonerror values from a column to new column, no blank cells in between
    By farmerdave in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-24-2009, 12:47 AM

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