1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Macro repeat command

Discussion in 'Business Applications' started by palko, Sep 12, 2003.

Thread Status:
Not open for further replies.
Advertisement
  1. palko

    palko Thread Starter

    Joined:
    Sep 11, 2003
    Messages:
    6
    Created a macro via excel from a database and it runs as I planned. But how do I have it repeat the sequence until it runs out of data?
    It is a database from where a report is generated for the participants. Mine stops after executing the first line BUT it is to go on untill it reaches the last line.

    Thanks.

    palko
     
  2. CastleHeart

    CastleHeart

    Joined:
    May 4, 2002
    Messages:
    743
    I'm slow this morning.

    Can you give a little more info?


    - Castleheart
     
  3. XL Guru

    XL Guru

    Joined:
    Aug 30, 2003
    Messages:
    2,702
    Perhaps Palko means "how do I make it work for each row in the database?" (?)

    What's yr preference CH? Wrap it with

    Do Until Active Cell = ""
    (do stuff)
    ActiveCell.Range("A2").Select
    Loop

    or

    For Each ? in ?
    (do stuff)
    Next

    Rgds,
    Andy
     
  4. CastleHeart

    CastleHeart

    Joined:
    May 4, 2002
    Messages:
    743
    Hello palko
    Hey there XLG -

    Without knowing a wee bit more about the macro, it is hard to say. But I would envision a simple

    Do Until ActiveCell = ""
    Loop

    Palko, give a hint as to what your macro is doing!

    - C
     
  5. palko

    palko Thread Starter

    Joined:
    Sep 11, 2003
    Messages:
    6
    I have a database (120 lines with certain info).
    The data changes every month.
    From this database I need to send a statement with selected information to each participant.
    The macro I recorded does exactly what I ask, but just for the first line.
    I'd like it to go line by line and print the statements from each line.
    Thanks

    :)

    The statement is on a FORM (template)

    I can print out the macro and send it via fax to anyone will9ing to tackle this and with the fax goes my many thanks
     
  6. XL Guru

    XL Guru

    Joined:
    Aug 30, 2003
    Messages:
    2,702
    What's a fax?

    For this you need (a) 2 worksheets (the form, plus your customer list) (b) x cells on the form sheet using OFFSET function to pull in your data from the list sheet (c) a "control" cell on the form sheet to increment by 1 over and again until it reaches the number of customers (d) ½ a dozen lines of code.

    If you'd like me to mail you a tiny demo file just ask.

    Rgds,
    Andy
     
  7. CastleHeart

    CastleHeart

    Joined:
    May 4, 2002
    Messages:
    743
    " Just the fax, mam!"


    Well, I'm kinda of curious now. Send me that 'fax' thingy, Palko!




    - Castleheart :cool:



    XLG, I smell smoke! Your gears must be spinning!
    I think I am going to go off in a slightly different direction. we'll see if i get lost..........

    (PS: Well, Palko.... you make it difficult to send you a fax # with Email or messaging. Get up with me.)
     
  8. XL Guru

    XL Guru

    Joined:
    Aug 30, 2003
    Messages:
    2,702
    CH, soz can't hang, early start tomorrow.

    Range("Form!K1") = 0
    'counter cell
    Do Until Range("Form!K1") = Range("Form!K2")
    'K2 formula =COUNTA(Sheet2!A:A)-1,
    # of data rows - header row
    Range("Form!K1") = Range("Form!K1") + 1
    Sheets("Form").PrintOut Copies:=1, Collate:=True
    Loop
    Range("Form!K1") = 0

    Form sheet cells contain eg:
    =OFFSET(Sheet2!$A$1,Form!$K$1,0)
    to pull in data sequentially as K1 increments thru looping.

    Rgds,
    Andy
     
  9. palko

    palko Thread Starter

    Joined:
    Sep 11, 2003
    Messages:
    6
    If you Honorable Gentlemen would kindly give me your email address I would attach the database, the template and my explanation of what I am trying to accomplish.
    And if you succeed, I will be a MU fan for life. :)
    And I firmly believe that it was a treason for B to go to the Royals.
    :)
     
  10. XL Guru

    XL Guru

    Joined:
    Aug 30, 2003
    Messages:
    2,702
    >> if you succeed, I will be a ** fan for life

    Hmm ... I'm surprised swearing's allowed in these groups. Reminds me of a humorous radio interview --

    "Where are you from?"
    "Manchester".
    "& who do you support?"
    "Man City".
    "Really? Why?"
    "Because I'm from Manchester".

    Best rgds,
    Andy
     
  11. CastleHeart

    CastleHeart

    Joined:
    May 4, 2002
    Messages:
    743
    I was asleep.

    But I think I am not now.



    Would ya'll across the way kindly lean out your windows and whistle for ISABEL. Maybe she'll swing on east. She's awful mean, and she's bearing right down our way!

    Palko,
    Send the schtuff by clicking the
    button below - - - - - - - v
     
  12. Anne Troy

    Anne Troy

    Joined:
    Feb 14, 1999
    Messages:
    11,746
    First Name:
    Anne
    palko: The guys are trying to say that they cannot send you their fax number or email address because, in your User Panel, you do not have "allow private messaging" or "allow members to see your email address" checked. They don't want to put that information right out in a public forum anymore than you do.

    :)
     
  13. XL Guru

    XL Guru

    Joined:
    Aug 30, 2003
    Messages:
    2,702
    Meanwhile, palko mailed me direct to advise that someone had fixed it for him IRL "for 20 bucks".

    Apols for the oversight, should've updated.

    Rgds,
    Andy
     
  14. CastleHeart

    CastleHeart

    Joined:
    May 4, 2002
    Messages:
    743
    You took my mouth right out from around my words, Dreamboat !!!!
    ... or something like that!


    - C
     

    Attached Files:

    • isa.jpg
      isa.jpg
      File size:
      40.4 KB
      Views:
      170
  15. Anne Troy

    Anne Troy

    Joined:
    Feb 14, 1999
    Messages:
    11,746
    First Name:
    Anne
    I don't watch the news. Thanks for the warning!
    Now you know why they call that Water Street there in East Greenville....hee hee.

    Don't worry. Hubby says we've got candles and food. I've got a water cooler right here in the house with 3 backup 5-gallon bottles, so we're doing okay. :)
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/164168

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice