+ Reply to Thread
Results 1 to 7 of 7

Copy certain rows and columns if data appears in one cell

  1. #1
    Registered User
    Join Date
    08-04-2009
    Location
    scotland
    MS-Off Ver
    Excel 2003
    Posts
    19

    Cool Copy certain rows and columns if data appears in one cell

    Hi,

    I'm looking for vba which would look from cell A5 downwards for any information (anything not blank). For every row that has data I want the vba to copy particular columns from that row.

    Ie. Cell A5 has data = copy cell A5,B5,E5,H5

    continue until last row with data and the clipboard should contain all neccesary copied cells.

    This data would then be manually pasted elsewhere.

    Is this possible?

    Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Copy certain rows and columns if data appears in one cell

    Please Try
    Please Login or Register  to view this content.
    After you enter data into Cell A5, It will select Column's A,B,E & H from row 5 down.
    Note is there is blank cells withen this range they will be selected.

    Hope that helps

  3. #3
    Registered User
    Join Date
    08-04-2009
    Location
    scotland
    MS-Off Ver
    Excel 2003
    Posts
    19

    Smile Re: Copy certain rows and columns if data appears in one cell

    Thanks a lot,

    It nearly works, however, it copies all cells below row 5 in column B,E & H.

    I would like it to only copy the rows which have been copied in column A.

    ie, If A5 & A6 are the only cells with data it will only select cells A5, B5, E5, H5, A6, B6, E6, H6

    Cheers!

  4. #4
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Copy certain rows and columns if data appears in one cell

    Try
    Please Login or Register  to view this content.
    I must admit this is a prity amature approach.
    It also assumes that if A has date B,E&H also have data.

    I was playing with this before i read your second post, Post 2 may be better to adapt. Though i have ran out of time tonight.
    If you need a diffrent approach than this ill see if i can convince someone else to lend a hand.
    Last edited by D_Rennie; 08-20-2009 at 09:48 AM.

  5. #5
    Registered User
    Join Date
    08-04-2009
    Location
    scotland
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Copy certain rows and columns if data appears in one cell

    Hi,

    Tried this and played about with it, however, I cannot have it copy and paste data to a new sheet as it loses the cell data because the reference has changed.

    it also seems to still be copying the majority of the row rather than the four cells.

    If you can help further please let me know.

    Thanks!

  6. #6
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Copy certain rows and columns if data appears in one cell

    It should only copy the cells you want.
    also try changing the line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    I have realy got near the end of my experiecne on this. I have requsted for someone else to look at it for you. If they dont have the time to pick up on it im sure someone else will.

    Good luck.

    Maby post a sample workbook to speed things along.

  7. #7
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    Re: Copy certain rows and columns if data appears in one cell

    HI
    Paste your data in sheet1 and try the macro.
    Ravi
    Attached Files Attached Files

+ 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