I need to copy data from one sheet to another with a limited selection of columns using VBA, not continuous and transpose the copied data in a column while pasting to another sheet. Also, I want to skip the empty cells while doing so.
I want to apply a loop but I am not able to declare the ranges of cells exactly as they should be. I am very new to VBA and below is the code which I am using trying to achieve the goal.
Option Explicit
Sub CopyPasteLoop()
Dim X As Long
Dim Y As Long
Dim Col As Long
Dim row1 As Long
'Dim A As Long
Col = 1
Sheets("Copy").Activate
'For A = 1 To 10000
row1 = Sheets("Copy").Range(.Cells(.Rows.Count, Col)).End(xlUp).row
Sheets("Key Entry Data").Activate
X = Sheet2.Range("A" & Rows.Count).End(xlUp).row
'Y = Sheet1.Cells(1, Columns.Count).End(xlToLeft).Column
Sheets("Copy").Activate
Sheet1.Range("Col" & 2, "Col" & row1).Select
Selection.Copy
'X = X + 1
Sheets("Key Entry Data").Activate
Sheet2.Cells(X).Select
Sheet2.Range("A" & X).PasteSpecial xlPasteValues
Col = ActiveCell.Next.EntireColumn.Cells(1).Select
'Next X
End Sub