Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Syntax problem


Can anyone debug this?

Sub TransposeData3()
sr = 1
dr = 0
For sr = 1 To 29 Step 10 ' Change 100 to suit number of rows in th
source
Column
dr = dr + 1
Range(Cells(sr, 1), Cells(sr + 9, 1)).Select ' Select A1:A1
first
loop, then A11:A20 next loop etc
Selection.Copy
Cells(dr, 2).Select ' Select B1 first loop, then B2 second loo
etc
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Next
End Su

--
unknowndevic
-----------------------------------------------------------------------
unknowndevice's Profile: http://www.excelforum.com/member.php...fo&userid=2664
View this thread: http://www.excelforum.com/showthread.php?threadid=39961

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Syntax problem

Sub TransposeData3()
sr = 1
dr = 0
rw = Cells(Rows.Count, sr).End(xlUp)
For sr = 1 To rw + 9 Step 10
dr = dr + 1
Range(Cells(sr, 1), Cells(sr + 9, 1)).Select
Selection.Copy
Cells(dr, 2).Select
Selection.PasteSpecial _
Paste:=xlPasteAll, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=True
Next
End Sub

--
Regards,
Tom Ogilvy
"unknowndevice"
wrote in message
news:unknowndevice.1ue3md_1125090326.0714@excelfor um-nospam.com...

Can anyone debug this?

Sub TransposeData3()
sr = 1
dr = 0
For sr = 1 To 29 Step 10 ' Change 100 to suit number of rows in the
source
Column
dr = dr + 1
Range(Cells(sr, 1), Cells(sr + 9, 1)).Select ' Select A1:A19
first
loop, then A11:A20 next loop etc
Selection.Copy
Cells(dr, 2).Select ' Select B1 first loop, then B2 second loop
etc
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Next
End Sub


--
unknowndevice
------------------------------------------------------------------------
unknowndevice's Profile:

http://www.excelforum.com/member.php...o&userid=26646
View this thread: http://www.excelforum.com/showthread...hreadid=399610



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Syntax problem

unknowndevice,

I think you may be expecting different results from the "step 10" portion of
your for loop than what you'll actually get. E.g.,

Dim i As Long
For i = 1 To 29 Step 10
Debug.Print i
Next i

results in 1, 11 and 21 whereas it looks like you're expecting 10, 20, 30
....

hth,

Doug

"unknowndevice"
wrote in message
news:unknowndevice.1ue3md_1125090326.0714@excelfor um-nospam.com...

Can anyone debug this?

Sub TransposeData3()
sr = 1
dr = 0
For sr = 1 To 29 Step 10 ' Change 100 to suit number of rows in the
source
Column
dr = dr + 1
Range(Cells(sr, 1), Cells(sr + 9, 1)).Select ' Select A1:A19
first
loop, then A11:A20 next loop etc
Selection.Copy
Cells(dr, 2).Select ' Select B1 first loop, then B2 second loop
etc
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Next
End Sub


--
unknowndevice
------------------------------------------------------------------------
unknowndevice's Profile:
http://www.excelforum.com/member.php...o&userid=26646
View this thread: http://www.excelforum.com/showthread...hreadid=399610



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Syntax problem

Think you are misreading the intent of the code. Printing out Sr and Area
to be transpose:

1 $A$1:$A$10
11 $A$11:$A$20
21 $A$21:$A$30
31 $A$31:$A$40
41 $A$41:$A$50

--
Regards,
Tom Ogilvy

"Doug Glancy" wrote in message
...
unknowndevice,

I think you may be expecting different results from the "step 10" portion

of
your for loop than what you'll actually get. E.g.,

Dim i As Long
For i = 1 To 29 Step 10
Debug.Print i
Next i

results in 1, 11 and 21 whereas it looks like you're expecting 10, 20, 30
...

hth,

Doug

"unknowndevice"


wrote in message
news:unknowndevice.1ue3md_1125090326.0714@excelfor um-nospam.com...

Can anyone debug this?

Sub TransposeData3()
sr = 1
dr = 0
For sr = 1 To 29 Step 10 ' Change 100 to suit number of rows in the
source
Column
dr = dr + 1
Range(Cells(sr, 1), Cells(sr + 9, 1)).Select ' Select A1:A19
first
loop, then A11:A20 next loop etc
Selection.Copy
Cells(dr, 2).Select ' Select B1 first loop, then B2 second loop
etc
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Next
End Sub


--
unknowndevice
------------------------------------------------------------------------
unknowndevice's Profile:
http://www.excelforum.com/member.php...o&userid=26646
View this thread:

http://www.excelforum.com/showthread...hreadid=399610





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Syntax problem

Tom,

I think you're right.

Thanks,

Doug

"Tom Ogilvy" wrote in message
...
Think you are misreading the intent of the code. Printing out Sr and Area
to be transpose:

1 $A$1:$A$10
11 $A$11:$A$20
21 $A$21:$A$30
31 $A$31:$A$40
41 $A$41:$A$50

--
Regards,
Tom Ogilvy

"Doug Glancy" wrote in message
...
unknowndevice,

I think you may be expecting different results from the "step 10" portion

of
your for loop than what you'll actually get. E.g.,

Dim i As Long
For i = 1 To 29 Step 10
Debug.Print i
Next i

results in 1, 11 and 21 whereas it looks like you're expecting 10, 20, 30
...

hth,

Doug

"unknowndevice"


wrote in message
news:unknowndevice.1ue3md_1125090326.0714@excelfor um-nospam.com...

Can anyone debug this?

Sub TransposeData3()
sr = 1
dr = 0
For sr = 1 To 29 Step 10 ' Change 100 to suit number of rows in the
source
Column
dr = dr + 1
Range(Cells(sr, 1), Cells(sr + 9, 1)).Select ' Select A1:A19
first
loop, then A11:A20 next loop etc
Selection.Copy
Cells(dr, 2).Select ' Select B1 first loop, then B2 second loop
etc
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Next
End Sub


--
unknowndevice
------------------------------------------------------------------------
unknowndevice's Profile:
http://www.excelforum.com/member.php...o&userid=26646
View this thread:

http://www.excelforum.com/showthread...hreadid=399610







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
Problem with Syntax? MurrayBarn Excel Worksheet Functions 8 June 12th 09 01:45 PM
Syntax problem Alex H Excel Worksheet Functions 1 July 2nd 05 08:23 AM
Operator syntax - VBA problem laserface Excel Programming 4 September 3rd 04 12:19 AM
Another Syntax Problem Sharlene England Excel Programming 2 December 2nd 03 10:04 PM


All times are GMT +1. The time now is 03:17 PM.

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

About Us

"It's about Microsoft Excel"