Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 41
Default copy transpose and paste error!?

I am trying to transpose and copy data from sheet1! from c8..f8; C144..F144,
C277..F277, C410..F410, C545..F545, C680..F680, C815..F815

to:

Sheet2
G20..G23, G24..G27, ....till end.

I am using the below sub:
Sub test()

Dim Destcol As Long, Originrow As Long, Destrow As Long, i As Long
Originrow = 8
Destcol = 7
Destrow = 20
For Originrow = 8 To 818 Step 135
Range(Cells(Originrow, 2), Cells(Originrow + 3, 6)).Copy _
Destination:=Sheet2!Cells(Destcol, Destrow)
Destrow = Destrow + 1
Next
End Sub

I am getting the error [runtime error 438 object doesnot support this
property or method] Could you help please?

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 41
Default copy transpose and paste error!? Any help

Hi there;
Using the archive of posts here I came up with below, it comes out with no
error but nothing happens. Can anybody please help, I hardly know any
programing. Appreciate your help.

Sub test()

Dim Destcol As Long, Originrow As Long, Destrow As Long, i As Long
Dim ws2 As Worksheet
Set ws2 = Sheets("Sheet2")

Originrow = 8
Destcol = 7
Destrow = 20

For Originrow = 8 To 818 Step 135

Range(Cells(Originrow, 2), Cells(Originrow + 3, 6)).Copy
ws2.Cells(Destcol, Destrow + 1)
Originrow = Originrow + 1
Next
End Sub



"Darius" wrote:

I am trying to transpose and copy data from sheet1! from c8..f8; C144..F144,
C277..F277, C410..F410, C545..F545, C680..F680, C815..F815

to:

Sheet2
G20..G23, G24..G27, ....till end.

I am using the below sub:
Sub test()

Dim Destcol As Long, Originrow As Long, Destrow As Long, i As Long
Originrow = 8
Destcol = 7
Destrow = 20
For Originrow = 8 To 818 Step 135
Range(Cells(Originrow, 2), Cells(Originrow + 3, 6)).Copy _
Destination:=Sheet2!Cells(Destcol, Destrow)
Destrow = Destrow + 1
Next
End Sub

I am getting the error [runtime error 438 object doesnot support this
property or method] Could you help please?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default copy transpose and paste error!?

I'm confused about your code and your note.

You say C:F should be copied. But your code starts in column 2 (B).

I used column 2 (B).

Option Explicit
Sub testme01()

Dim DestCell As Range
Dim OriginRow As Long

Set DestCell = Worksheets("Sheet2").Range("G20")

With Worksheets("Sheet1")
For OriginRow = 8 To 818 Step 135
.Cells(OriginRow, 2).Resize(1, 4).Copy
DestCell.PasteSpecial Transpose:=True
Set DestCell = DestCell.Offset(4, 0)
Next OriginRow
End With

End Sub





Darius wrote:

Dave;
Thank you so much for your help.
Still has 2 problems, it paste the data in the same sheet1 and not sheet 2.
And also the pasted data supposed to come in one coulmn (Col G in sheet2)
start from G20....G..
Appreciate your help

"Dave Peterson" wrote:

Don't you have a problem with the step, too? 8 to 144 isn't 135.

Dim DestCell as range
dim Originrow As Long
dim i As Long

set destcell = range("G20")

For Originrow = 8 To 818 Step 135
Cells(Originrow, 2).resize(1,4).Copy
destcell.pastespecial transpose:=true
set destcell = destcell.offset(0,1)
Next originrow

Sometimes, this syntax:
Cells(Originrow, 2).resize(1,4).Copy _
is easier to read than:
Range(Cells(Originrow, 2), Cells(Originrow, 6)).Copy _

And why did you change that to "originrow + 3"? That doesn't match your
description.


Darius wrote:

I am trying to transpose and copy data from sheet1! from c8..f8; C144..F144,
C277..F277, C410..F410, C545..F545, C680..F680, C815..F815

to:

Sheet2
G20..G23, G24..G27, ....till end.

I am using the below sub:
Sub test()

Dim Destcol As Long, Originrow As Long, Destrow As Long, i As Long
Originrow = 8
Destcol = 7
Destrow = 20
For Originrow = 8 To 818 Step 135
Range(Cells(Originrow, 2), Cells(Originrow + 3, 6)).Copy _
Destination:=Sheet2!Cells(Destcol, Destrow)
Destrow = Destrow + 1
Next
End Sub

I am getting the error [runtime error 438 object doesnot support this
property or method] Could you help please?


--

Dave Peterson


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 41
Default copy transpose and paste error!?

Perfect.
Thanks. I changed the column number to 3 by the way.

"Dave Peterson" wrote:

I'm confused about your code and your note.

You say C:F should be copied. But your code starts in column 2 (B).

I used column 2 (B).

Option Explicit
Sub testme01()

Dim DestCell As Range
Dim OriginRow As Long

Set DestCell = Worksheets("Sheet2").Range("G20")

With Worksheets("Sheet1")
For OriginRow = 8 To 818 Step 135
.Cells(OriginRow, 2).Resize(1, 4).Copy
DestCell.PasteSpecial Transpose:=True
Set DestCell = DestCell.Offset(4, 0)
Next OriginRow
End With

End Sub





Darius wrote:

Dave;
Thank you so much for your help.
Still has 2 problems, it paste the data in the same sheet1 and not sheet 2.
And also the pasted data supposed to come in one coulmn (Col G in sheet2)
start from G20....G..
Appreciate your help

"Dave Peterson" wrote:

Don't you have a problem with the step, too? 8 to 144 isn't 135.

Dim DestCell as range
dim Originrow As Long
dim i As Long

set destcell = range("G20")

For Originrow = 8 To 818 Step 135
Cells(Originrow, 2).resize(1,4).Copy
destcell.pastespecial transpose:=true
set destcell = destcell.offset(0,1)
Next originrow

Sometimes, this syntax:
Cells(Originrow, 2).resize(1,4).Copy _
is easier to read than:
Range(Cells(Originrow, 2), Cells(Originrow, 6)).Copy _

And why did you change that to "originrow + 3"? That doesn't match your
description.


Darius wrote:

I am trying to transpose and copy data from sheet1! from c8..f8; C144..F144,
C277..F277, C410..F410, C545..F545, C680..F680, C815..F815

to:

Sheet2
G20..G23, G24..G27, ....till end.

I am using the below sub:
Sub test()

Dim Destcol As Long, Originrow As Long, Destrow As Long, i As Long
Originrow = 8
Destcol = 7
Destrow = 20
For Originrow = 8 To 818 Step 135
Range(Cells(Originrow, 2), Cells(Originrow + 3, 6)).Copy _
Destination:=Sheet2!Cells(Destcol, Destrow)
Destrow = Destrow + 1
Next
End Sub

I am getting the error [runtime error 438 object doesnot support this
property or method] Could you help please?

--

Dave Peterson


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy and Transpose Paste HAS Excel Discussion (Misc queries) 2 February 15th 09 01:50 PM
Copy then Paste with a transpose SteveM Excel Discussion (Misc queries) 2 November 29th 07 06:01 PM
how to create a copy/paste special/transpose macro? [email protected] Excel Discussion (Misc queries) 6 August 8th 07 06:07 AM
Copy / Paste - Kind of Transpose Carl Jarvis New Users to Excel 1 October 11th 05 04:27 AM
HELP....Is there a way to automate copy/paste special/transpose - Mel Excel Worksheet Functions 7 March 28th 05 11:17 PM


All times are GMT +1. The time now is 08:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"