G
Guest
Hi all,
I'm trying to set a variable called "header" to the values that currently
occupy range(A1:L1) on Sheet2. I then want to go to Sheet3 and paste the
values copied into various locations in the sheet. I was thinking I should
be using an array to do this, but honestly afer looking through various help
topics on arrays, it just wasn't clear enough. Below is my "attempted"
code...though this does not work, I'm hoping you see what I'm trying to do
here. Thanks for your help!
Sub copyheader()
Dim header(0, 11) As String 'there will only be text values stored in this
variable
Dim range1 As Range
With Sheets("Sheet2")
Set header = .Range("A1:L1")
End With
With Sheets("Sheet3")
For Each A In range1
If A.Value = "Need header" Then
A.Value = header.PasteSpecial(xlPasteAll)
Else
End If
Next
End With
End Sub
I'm trying to set a variable called "header" to the values that currently
occupy range(A1:L1) on Sheet2. I then want to go to Sheet3 and paste the
values copied into various locations in the sheet. I was thinking I should
be using an array to do this, but honestly afer looking through various help
topics on arrays, it just wasn't clear enough. Below is my "attempted"
code...though this does not work, I'm hoping you see what I'm trying to do
here. Thanks for your help!
Sub copyheader()
Dim header(0, 11) As String 'there will only be text values stored in this
variable
Dim range1 As Range
With Sheets("Sheet2")
Set header = .Range("A1:L1")
End With
With Sheets("Sheet3")
For Each A In range1
If A.Value = "Need header" Then
A.Value = header.PasteSpecial(xlPasteAll)
Else
End If
Next
End With
End Sub