+ Reply to Thread
Results 1 to 2 of 2

Looping a Macro to bring in various cells according to a variable.

  1. #1
    Registered User
    Join Date
    03-09-2020
    Location
    Reno, NV
    MS-Off Ver
    2019
    Posts
    4

    Looping a Macro to bring in various cells according to a variable.

    Here is my code:

    Please Login or Register  to view this content.
    Basically this grabs a term from H1 and searches the Datasheet to find rows that match. It is then supposed to paste in the Cells 2-4 in the first three columns in another spreadsheet. Then the variables change and it is supposed to paste cells 9-11 in the next 3 columns of the spreadsheet.


    As it stands it does paste everything needed but first it pastes only the first three columns then it repeats and pastes all the information needed below that (filling cols 1-6). This gives me double information. I only want it to do the last iteration.

    Please see the attached xlsm file to understand what I am talking about.
    Attached Files Attached Files
    Last edited by Pepe Le Mokko; 03-12-2020 at 03:12 AM. Reason: Removed unnecessary title part

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Looping a Macro to bring in various cells according to a variable.

    Q1: Should you be modifying this statement based on i?
    Please Login or Register  to view this content.
    Try
    Please Login or Register  to view this content.
    Q2: How much data do you have?
    Your code is really slow.
    There are much faster solutions available to you.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

+ 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] Variable Length Array does not bring correct data
    By AZ-XL in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-16-2017, 08:20 AM
  2. [SOLVED] SUM when using a looping macro of variable length
    By locopete999 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-04-2016, 12:35 PM
  3. [SOLVED] Replace special characters macro not looping through cells
    By mattyfaz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2015, 06:04 AM
  4. Macro to filter a pivot whilst looping through filter criteria in a variable list.
    By Alistairm88 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-29-2015, 04:25 AM
  5. Looping through a variable with macro and autofilter
    By CLoos in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-20-2013, 06:06 PM
  6. Need help in looping of Macro between cells and worksheets
    By Manish_Gupta in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2013, 06:07 PM
  7. [SOLVED] Macro to bring empty cells of SearchResults to the bottom
    By kayoke in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-14-2012, 05:25 AM

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