Cyizere
Cyizere

Reputation: 3

Transfer(copy&paste) data from one tab to another with transpose in #vba

First of all, I'm new in VBA. Basically, I want to transfer data from one tab to another(within one doc) and paste them transposed.

The code I have here, allows me to move to the next row, after submitting data for the first person.

Sub Submit()

    Dim rngSource As Range
    Dim rngTarget As Range
    Dim iRow As Integer
    'tranferring data between macro
    Set rngSource = Worksheets("Checklist").Range("b1:b5")

    'figuring out the empty row
    iRow = Worksheets("Central Tracker").Cells(Rows.Count, 1).End(xlUp).Row + 1
    Set rngTarget = Worksheets("Central Tracker").Range("A" & iRow)
    rngSource.Copy Destination:=rngTarget.PasteSpecial Paste:= xlPasteValues


End Sub

Basically, I want to add in the transposed paste option but I don't know how I can do that. I will really appreciate your support. Thanks!

Upvotes: 0

Views: 119

Answers (1)

TourEiffel
TourEiffel

Reputation: 4424

Just use Transpose:=True

 Dim rngSource As Range
 Dim rngTarget As Range
 Dim iRow As Integer
 'tranferring data between macro
 Set rngSource = Worksheets("Checklist").Range("b1:b5")

'figuring out the empty row
iRow = Worksheets("Central Tracker").Cells(Rows.Count, 1).End(xlUp).Row + 1
Set rngTarget = Worksheets("Central Tracker").Range("A" & iRow)
rngSource.Copy 
rngTarget.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True

Upvotes: 1

Related Questions