Change code to Paste to the right.

SEMME

Board Regular
Joined
Jun 18, 2002
Messages
59
Thank you for your help . I have this code;

Dim PasteRange As Range

If Sheets("MAIN").Range("B1") = "" Then
Set PasteRange = Sheets("MAIN").Range("B2")
Else
Set PasteRange = Sheets("MAIN").Range("B65536").End(xlUp).Offset(1, 0)
End If

Sheets("MAIN").Range("A2:A36").Copy
PasteRange.PasteSpecial Paste:=xlPasteValues

How do I get this code to paste to the next empty column to the right
as oppposed to the bottom of column B?
Contents of A2:A36 will be pasted to B2:B36, then again to C2:C36 and so forth...

SEMME
 

Some videos you may like

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Sub test()
With Sheets("MAIN")
    .Range("A2:A36").Copy
    .Cells(2, Columns.Count).End(xlToLeft).Offset(, 1).PasteSpecial Paste:=xlPasteValues
End With
End Sub
 

SEMME

Board Regular
Joined
Jun 18, 2002
Messages
59
Yep VoG,
...that is what I was looking for, ohhh yeah! speeds things up..I'll tell you. hehe

Thx,
SEMME
 

Watch MrExcel Video

Forum statistics

Threads
1,108,969
Messages
5,525,958
Members
409,673
Latest member
Riseee

This Week's Hot Topics

Top