• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Mistake in my code to copy from sheet TextData1 to sheet TextData2

Lymm

Member
Hi I am using XL 2003 and wish to copy and transpose 10 rows of data from a list on sheet 1 to the next empty row on sheet 2.

Here is my code that dosnt work.


Sub


Sheets("TextData1").Range("A1:A10").Select

Selection.Copy

Sheets("TextData2").Select

Selection.End(xlDown).Offset(1, 0).Select

selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=

False, Transpose:=True

Sheets("TextData1").Select

Application.CutCopyMode = False

Selection.Delete Shift:=xlUp

Range("A1").Select

End Sub


Thank you for your assistance.
 
Hi Lymm ,


The following should work :

[pre]
Code:
'
Sheets("TextData1").Activate
Range("A1:A10").Select
Selection.Copy
Sheets("TextData2").Activate
Range("A1").Select
Selection.End(xlDown).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Sheets("TextData1").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Range("A1").Select
[/pre]

The following statement :


Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _

False, Transpose:=True


is actually a single statement , spread over 2 lines ; when continuing a statement over multiple lines , each line should have an underscore character ( _ ) at the end of that line , and nothing else , not even comments can be placed after this underscore character.


Narayan
 
Back
Top