Copy Excel data from columns to rows with VBA

后端 未结 6 1072
梦如初夏
梦如初夏 2021-01-21 20:16

I have a little experience with VBA, and I would really appreciate any help with this issue. In a basic sense, I need to convert 2 columns of data in sheet 1 to rows of data in

6条回答
  •  清歌不尽
    2021-01-21 20:39

    Try this:

    Sub TansposeRange()
     Dim InRange As Range
     Dim OutRange As Range
     Dim i As Long
    
     Set InRange = Sheet1.Range("B3:B10002")
     Set OutRange = Sheet2.Range("C2")
    
     InRange.Worksheet.Activate
     InRange.Select
     Selection.Copy
    
     OutRange.Worksheet.Activate
     OutRange.Select
    
     Selection.PasteSpecial Paste:=xlPasteValues, Transpose:=True
    
    End Sub
    

提交回复
热议问题