Array clarification, fairly simple

boldcode

Active Member
Joined
Mar 12, 2010
Messages
347
I am using the following piece of code below to populate values into A1, A2 and A3, but for some reason the first value of array gets repeated in cell A2 and A3.

Here is the code:

Code:
With wksNewP
       .Range("A1").Resize(3).Value = Array("Report Name:", "Times Used:", "Dates Used:")
    End With

What I end up with is this:

A1 = Report Name:
A2 = Report Name:
A3 = Report Name:

but what I want is this:

A1 = Report Name:
A2 = Times Used:
A3 = Dates Used:
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Array is a horizontal array. Like this:
Code:
With wksNewP
    .Range("A1").Resize(3).Value = _
        WorksheetFunction.Transpose(Array("Report Name:", _
        "Times Used:", "Dates Used:"))
End With
 
Upvote 0
boldcode,

Try this...

Code:
With wksNewP
For r = 0 To 2
       .Range("A1").Offset(r, 0).Value = Array("Report Name:", "Times Used:", "Dates Used:")(r)    
Next r
End With
Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,214,412
Messages
6,119,365
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top