Announcement

Collapse
No announcement yet.

Copy/Paste Loop

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Copy/Paste Loop



    Hi, i very much appreciate guidance on the following. On a worksheet i have the following range named "Stock_List"

    A1 = "SP"
    A2 = "XOM"
    A3 = "FB"
    A4 = "APPL"
    A5 = "DJIA"


    Currently in my input cell Q1 (which is a named cell "Ticker_Input") i manually cycle through "SP" then replace with "XOM" then replace with "FB" then replace with "APPL" and then replace with "DJIA" to run various scenarios in an excel model

    I would like a macro that will automate this process, so rather than me doing it manually 1 by 1, the macro will do it automatically. My actual "Stock_List" range is A1:A500

    Thank you - Alex

  • #2
    Hi Alex,
    maybe something like this
    Code:
    Sub ttt()
    Dim x, i&
    x = Range("Stock_List").Value
    For i = 1 To UBound(x)
        Range("Q1").Value = x(i, 1)
        MsgBox x(i, 1)
    Next i
    End Sub

    Comment


    • #3


      Thank you nilem this works perfect and provides me the base to further build out my infrastructure

      Comment

      Working...
      X