+ Reply to Thread
Results 1 to 3 of 3

Trouble with loop

  1. #1
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    164

    Trouble with loop

    Hello All!

    I'm having some issues with a project I'm working on. I want to generate a report based on user selected criteria (done in a UserForm) and copy the rows of data that meet the criteria to a different worksheet. Here is my code so far.

    Please Login or Register  to view this content.
    Essentially, there are 3 potential sets of criteria. The first is the year and will always be included. The second two may not always be there based on the users preference. They are Month and a random assortment of other misc data such as name. The user picks these criteria in a userform and once they click 'create report' the UF dumps these selections into the spreadsheet. Therefore the report can have 4 possible outcomes:

    1: A (Just the Year)
    2: A & B (Year and a Month)
    3: A & C (Year and name)
    4: A, B & C (Year, Month and Name)

    While in case A the code row must have a matching Year in order to be true, in the others that row must then have a matching B and/or C in order to be true and be copied into the other worksheet. I hope I'm making this all clear.

    When I ran the code it just kept going and going, but didn't produce any data. Any Ideas?

    Thanks

  2. #2
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    164

    Re: Trouble with loop

    I did some more research and reworked the above macro into this....
    Please Login or Register  to view this content.
    But it still doesn't work. Any Ideas?

  3. #3
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    164

    Re: Trouble with loop

    Well I figured just about everything out with this issue, however I still have one problem. I'm trying to offset the activecell by using a variable since I don't know how much I need to offset by everytime. Here is my code.

    Please Login or Register  to view this content.
    Can anyone help?

+ 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] I am having trouble accessing information with an if loop.
    By Spreadlover in forum Excel Formulas & Functions
    Replies: 32
    Last Post: 07-17-2013, 04:39 PM
  2. VBA Find Copy Loop Trouble
    By antora in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-14-2013, 04:04 AM
  3. Trouble with Formula (in loop)
    By dugong in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-11-2008, 05:27 AM
  4. loop, Trouble with Minus Sign
    By canofpi in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-02-2007, 06:05 PM
  5. trouble with counter in range loop
    By brya6347 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2005, 06:25 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