Connolly Destin
Connolly Destin

Reputation: 9

Writing To A Range Using VBA array

I have a script that pulls the first cell value of a table from a database and adds it 10 times. I want to write that list to excel.

Here's what I have so far:

sub x()
    Dim myArray As Variant
    Dim i As Variant

    myArray = Sheets("License Plate Number").Range("LP")
    myVariable = (Trim(Right(mp_start, 12)))

    For i = 0 To (ord_qty / 120) - 1

        Myarr = "MP" & myVariable + i
        myArray = Myarr

        'MsgBox Myarr
        Debug.Print Myarr

    Next i

end sub 

How can I write to a range using VBA?

Upvotes: 0

Views: 1357

Answers (1)

braX
braX

Reputation: 11755

It's very simple. You just do it like this.

Range("A1:J1")=Myarr

Upvotes: 2

Related Questions