+ Reply to Thread
Results 1 to 6 of 6

VBA Question about using For Each loop

  1. #1
    Registered User
    Join Date
    02-05-2014
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    29

    VBA Question about using For Each loop

    Hey!

    So I have a big sheet that I'm working on that is using this code to pull items over from one sheet to the next which works great until I change some values in it and I'm not sure why.

    Please Login or Register  to view this content.
    So when I change it to source.range to A:D instead of A:C, it will paste repetitively for thousands of more columns past A:D. So E:H will have the data too, etc for thousands of rows. Just wondering what I'm doing wrong there!

    Thanks!!!


    [/CODE]
    Last edited by jamief; 12-11-2019 at 06:33 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,419

    Re: VBA Question about using For Each loop

    I'd be inclined to change this
    Please Login or Register  to view this content.
    to this
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    02-05-2014
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    29

    Re: VBA Question about using For Each loop

    That fixed that issue! Thanks!

    I did run into another issue right after though.

    K here's some more code.

    I'm sure there's reason I can't do something I did here...

    Basically, Once all the info is on the "CSV2" sheet, I want for it to use the same code to look on that sheet for any A's in column D, and copy and paste them to the "Order" sheet, then go through the same info, and copy all the B's, etc.

    Am I able to use this code multiple times like this? or is there a different way I should do this?

    Thanks again, you da bomb.

    Please Login or Register  to view this content.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,419

    Re: VBA Question about using For Each loop

    You're looking at column C, not column D.

  5. #5
    Registered User
    Join Date
    02-05-2014
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    29

    Re: VBA Question about using For Each loop

    It's been a long morning

    Thanks!!

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,419

    Re: VBA Question about using For Each loop

    You're welcome. Thanks for the rep.

+ 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. [SOLVED] Question Regarding a For Loop
    By unit285 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-25-2017, 04:26 PM
  2. [SOLVED] For next loop question.
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-29-2014, 04:08 PM
  3. Loop question..
    By calvinle in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-12-2014, 12:40 AM
  4. [SOLVED] Loop within a Loop Question
    By vexel77 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2013, 11:26 AM
  5. VBA loop question
    By JediMind in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 04-29-2010, 04:40 PM
  6. For next loop question
    By hydrojoe11 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2008, 11:32 AM
  7. For...Next Loop question
    By CWatsonJr in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-12-2005, 04:26 PM

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