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

  • Hi Alex,
    maybe something like this

    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

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!