Transform entities from column of 1 sheet1 to row of another sheet

T

Thulasiram

How to transfer the entities in the columns of one worksheet to rows of
another worksheet in an Excel book?. For example I would like to copy 50
entities in column A of worksheet 1 to row 1 of worksheet 2.

So, for the above question I would like to know the code that should be
written in the VB code editor (for the command button with caption "Shift
Entities").
 
D

Die_Another_Day

Private Sub ShiftEntities_Click()
Dim wb2 As Workbook
Set wb2 = Workbooks("YourBook2.xls")
Range("A1:A50").Copy
Windows("Book2").Activate
Range("A1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
End Sub

HTH

Die_Another_Day
 
T

Thulasiram

Thanks a lot.

Die_Another_Day said:
Private Sub ShiftEntities_Click()
Dim wb2 As Workbook
Set wb2 = Workbooks("YourBook2.xls")
Range("A1:A50").Copy
Windows("Book2").Activate
Range("A1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
End Sub

HTH

Die_Another_Day
 
T

Thulasiram

I get an error when I pasted the code in the VBA script. i changed
YourBook2.xls as Sample.xls as its the file name. Compiler shows error in
Windows("Book2").Activate

and

Range("A1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

Please help
 
T

Thulasiram

Hello.

When I paste the code in the script editor, i get an error in the
following lines.

Range("A1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

please help. it will b so nice of you.

Awaiting your response,
Thulasiram
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top