macfam929
New Member
- Joined
- Jul 28, 2010
- Messages
- 13
I am writing a macro to find the last used column in a worksheet, add one to it, select row 1 in that column, and then paste a bunch of data from another worksheet into the empty column. However it wont work. It successfully finds the last column but will not paste into it.
I have the following code:
Dim LastCol As Integer
Sheets(LastSheetName).Select
Range("T1:T69").Select
Selection.Copy
Sheets("Summary").Select
LastCol = Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByColumns).Column
Range(Cells(1, LastCol + 1)).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, Transpose:=False
any help would be greatly appreicated! Thank you.
FYI: If I replace "Range(Cells(1, LastCol + 1)).Select" with a hardcoded value like "Range("F1").Select", it works no problem.
I have the following code:
Dim LastCol As Integer
Sheets(LastSheetName).Select
Range("T1:T69").Select
Selection.Copy
Sheets("Summary").Select
LastCol = Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByColumns).Column
Range(Cells(1, LastCol + 1)).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, Transpose:=False
any help would be greatly appreicated! Thank you.
FYI: If I replace "Range(Cells(1, LastCol + 1)).Select" with a hardcoded value like "Range("F1").Select", it works no problem.