ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I paste data to an variable row? (https://www.excelbanter.com/excel-programming/286615-how-do-i-paste-data-variable-row.html)

DAVE McClean

How do I paste data to an variable row?
 
Any help on this would be greatly appreciated. What I'm trying to do is copy
data from a set range of cells, and paste that data to a variable row & set
column.
Thank You

Dave



Mike Fogleman

How do I paste data to an variable row?
 
Dim VarRow as Integer
VarRow = Some formula to find a row
Range("B6:C" & VarRow).Paste

"DAVE McClean" wrote in message
hlink.net...
Any help on this would be greatly appreciated. What I'm trying to do is

copy
data from a set range of cells, and paste that data to a variable row &

set
column.
Thank You

Dave





Tom Ogilvy

How do I paste data to an variable row?
 
Dim rng as Range
set rng = worksheets("sheet1").Range("B1:C20")
rng.copy Destination:=Worsheets("sheets2"). _
Cells(rows.count,1).End(xlup)(2)

--
Regards,
Tom Ogilvy

DAVE McClean wrote in message
hlink.net...
Any help on this would be greatly appreciated. What I'm trying to do is

copy
data from a set range of cells, and paste that data to a variable row &

set
column.
Thank You

Dave





Patrick Molloy[_4_]

How do I paste data to an variable row?
 
you don't say how you select the source that you want to copy.
So...

Dim Source as Range
Dim Target as Range
SET Source = Worksheets("Sheet1").Range("G5:M27")
'or as another example...using a user-selected range
'SET Source = Selection

Set Target = Worksheets("Sheet3").Range("C3")
' or if the sourec was defined
SET Target = Selection

'now copy the data
With Target.Resize(Source.Rows.Count, Source.Columns.Count)
.Value = Source.Value
End With


--
Patrick Molloy
Microsoft Excel MVP
----------------------------------
"DAVE McClean" wrote in message
hlink.net...
Any help on this would be greatly appreciated. What I'm trying to do is

copy
data from a set range of cells, and paste that data to a variable row &

set
column.
Thank You

Dave






All times are GMT +1. The time now is 09:31 AM.

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