lundi 30 mars 2015

How to specify start row for a "copy column vba"?

I'm using the following string to copy a column from one sheet to another



Dim wsCore As Worksheet
Dim wsData As Worksheet

Set wsCore = Sheets("R2 Data Dump")
Set wsData = Sheets("Active")

Dim rowNumber As Integer
Dim cellFormulas As Variant
Dim cellFormulas1 As Variant
Dim counter As Integer
counter = 0
Dim currentCell As String
Dim importSheetCell As Variant
Dim importSheetOffset As Variant
Dim contractnum As Integer
Dim pt As PivotTable
Dim ws As Worksheet
Dim pc As PivotCache
Dim lastrow As Long

Set wsCore = Sheets("R2 Data Dump")
Set wsData = Sheets("Active")

Sheets("R2 Data Dump").Visible = True
Sheets("R2 Data Dump").Select
rowNumber = ActiveSheet.UsedRange.Rows.Count

With wsCore
Startrow = 3

wsCore.Columns("W").Copy Destination:=wsData.Columns("A")
wsCore.Columns("B").Copy Destination:=wsData.Columns("B")
wsCore.Columns("C").Copy Destination:=wsData.Columns("C")
wsCore.Columns("D").Copy Destination:=wsData.Columns("D")

End With.




So what is does is copy the particular columns from one shit and paste it on the specified column on the destination sheet. My problem is, the action starts pasting the copied cell from the source sheet to the first row on the destination cell. What I would like to find out is how to set a row number where it would start pasting instead of row 1.


Aucun commentaire:

Enregistrer un commentaire