+ Reply to Thread
Results 1 to 7 of 7

How to loop through columns

  1. #1
    Registered User
    Join Date
    12-10-2013
    Location
    usa
    MS-Off Ver
    Excel 2013
    Posts
    45

    How to loop through columns

    I have the following code that matches the date between two worksheets and copies and pastes the data for a specific column. In the one below it copies and paste for F14. I would like to loop through the columns such as F14 then G14 then H14 etc. How can I go about doing that?

    Please Login or Register  to view this content.
    Last edited by Leith Ross; 12-29-2013 at 09:04 PM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: How to loop through columns

    Hello todd18us,

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,607

    Re: How to loop through columns

    Please Login or Register  to view this content.
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    12-10-2013
    Location
    usa
    MS-Off Ver
    Excel 2013
    Posts
    45

    Re: How to loop through columns

    Hi,

    Thank you for the revised code. However, the above code does not match the data between the two worksheets. I cannot get it to run.

    Todd

  5. #5
    Registered User
    Join Date
    12-10-2013
    Location
    usa
    MS-Off Ver
    Excel 2013
    Posts
    45

    Re: How to loop through columns

    The code works but only copies and pastes the last column of data and puts it in column F of DCF. There are only two columns of data. So program should copy column and paste two columns and put it in column F and column G. Any ideas?

    Thank you B. Johnson

  6. #6
    Registered User
    Join Date
    12-10-2013
    Location
    usa
    MS-Off Ver
    Excel 2013
    Posts
    45

    Re: How to loop through columns

    Seem like there is a problem with ms.Range("F" & Cel.Row) = .Cells(rng.Row, rFind.Column)

    There should be a moving target for where the paste should occur. First in F then in G and so on of DCF.

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,607

    Re: How to loop through columns

    To attach a Workbook
    (please do not post pictures of worksheets)
    • Click Advanced (next to quick post),
    • Scroll down until you see "Manage Attachments",
    • Click that then select "add files" (top right corner).
    • Click "Select Files" find your file, click "open" click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Click "Done" at bottom right to close the Attachment Manager.
    • Click "Submit Reply"

+ 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. Loop through and sum columns
    By Hurricanefly in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-17-2013, 05:39 PM
  2. loop through columns in range and only copy columns that have value of 0
    By gherzberg in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-07-2012, 12:55 PM
  3. For each to loop through columns
    By alien3011 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2008, 04:14 AM
  4. Loop through Columns
    By Sally in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-23-2006, 02:24 AM
  5. loop over columns
    By kizzie in forum Excel General
    Replies: 4
    Last Post: 08-10-2005, 09:05 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