Get data into worksheet from User Defined Type

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
Hi All

Given that I have the following UDT:

Code:
Type myString
   s1 As String * 100
   s2 As String * 100
   s3 As String * 100
   s4 As String * 100
   s5 As String * 100
End Type

What is the quickest way for me to enter each element into contiguous cells, eg Range("A1:A5")?

I could write:

Code:
Range("A1").Value = myString.s1
Range("A2").Value = myString.s2
'etc etc

But I think (hope) there is a much quicker all-in-one-go way of doing it.

Thanks for any replies.
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

JimB

Board Regular
Joined
Sep 19, 2002
Messages
81
This is what I came up with...

Code:
With myString
    Range("A1:A5") = Application.WorksheetFunction.Transpose(Array(.s1, .s2, .s3, .s4, .s5))
End With
 

Watch MrExcel Video

Forum statistics

Threads
1,126,977
Messages
5,621,935
Members
415,867
Latest member
mauroccs

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
Top