ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   paste to next free colum on new Worksheet (https://www.excelbanter.com/excel-programming/356775-paste-next-free-colum-new-worksheet.html)

Ralph

paste to next free colum on new Worksheet
 
Hi,
I have a sheet with one colum of results, those results I would like to
paste onto the next worksheet into the frist empty colum after the data of
the previous results, in order to create a kind of history.

Martin

paste to next free colum on new Worksheet
 
Try this:

Sub PasteColumn()
Dim myRange As Variant
Dim mySheet As Worksheet
Set mySheet = Worksheets("Sheet2")
Set myRange = mySheet.Range("A1").CurrentRegion
If myRange.Cells.Count 1 Or (myRange.Cells.Count = 1 And
myRange.Cells(1).Value < "") Then
Set myRange = myRange.Offset(0, myRange.Columns.Count).Resize(1, 1)
Else
Set myRange = mySheet.Range("A1")
End If
Worksheets("Sheet1").Columns(1).Copy (myRange)
End Sub


"Ralph" wrote:

Hi,
I have a sheet with one colum of results, those results I would like to
paste onto the next worksheet into the frist empty colum after the data of
the previous results, in order to create a kind of history.



All times are GMT +1. The time now is 04:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com