+ Reply to Thread
Results 1 to 5 of 5

Cycling through a list of Names and repeating actions

  1. #1
    Registered User
    Join Date
    12-26-2011
    Location
    San Francisco
    MS-Off Ver
    Excel 2010
    Posts
    45

    Cool Cycling through a list of Names and repeating actions

    I have a list of Names (Name1, Name2, Name3, etc) and I want each Name to go through a series of actions:

    1) Application.Goto Reference:="Name1"
    2) Range("Name1_variable").Copy
    3) Take some other action

    4) Then, repeat the sequence for Name2


    How do I go about doing this?

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Cycling through a list of Names and repeating actions

    Hi BeefNoodleSoup
    I'd guess a "For Each" loop.
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: Cycling through a list of Names and repeating actions

    For reference, cross posted here
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  4. #4
    Registered User
    Join Date
    12-26-2011
    Location
    San Francisco
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Cycling through a list of Names and repeating actions

    I've defined a range of cells (A:A) as "referenceNames"
    In this range there are strings/values scattered throughout (some cells are empty)
    I then want to pick out these strings/values and assign them to "TableRef".
    How do I step through all these strings? Below is my stab at this below with the part I'm confused about between ***

    ----- Code -----

    Dim TableRef As String

    For i = 1 To ***Code for counting the number of strings/values in referenceNames***
    TableRef = Range("referenceNames")(i)
    Some action requiring TableRef
    Next i
    Last edited by BeefNoodleSoup; 12-27-2011 at 12:29 AM.

  5. #5
    Registered User
    Join Date
    12-26-2011
    Location
    San Francisco
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Cycling through a list of Names and repeating actions

    Thanks, I figured this out from the other forum

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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