One Paste, Many Cells

V

Vivien Parlat

Hello,

When I write the following string in notepad:

A <tab> B <newline>
C <tab> D

and copy/paste it to Excel, it fills 4 cells.
I tried to set the value of a range in a VBA macro to a string
containing
an equivalent content ("a" & vbTab & "b" & vbNewLine & "c" & vbTab &
"d")
But this does not work.

Could someone give me the magic lines to do that in programmatically ?

Thank you in advance
 
J

Jim Cone

Sub VivienRequest()
Dim vOne As Variant
Dim vTwo As Variant
Dim rng As Range

vOne = Array("a", "b")
vTwo = Array("c", "d")
Set rng = ActiveCell.Resize(2, 2)

rng.Rows(1).Value = vOne
rng.Rows(2).Value = vTwo
End Sub
--
Jim Cone
Portland, Oregon USA



"Vivien Parlat" <[email protected]>
wrote in message
Hello,
When I write the following string in notepad:

A <tab> B <newline>
C <tab> D

and copy/paste it to Excel, it fills 4 cells.
I tried to set the value of a range in a VBA macro to a string
containing
an equivalent content ("a" & vbTab & "b" & vbNewLine & "c" & vbTab & "d")
But this does not work.
Could someone give me the magic lines to do that in programmatically ?
Thank you in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top