One Paste, Many Cells

  • Thread starter Thread starter Vivien Parlat
  • Start date Start date
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
 
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
 
Back
Top