Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
simonsmith
 
Posts: n/a
Default loop bunny needs help


Hi,
Can anybody help me with this little beauty? I am a first time loop guy
so not sure what to do here... I have a table of data 8 columns wide and
normally 40 rows high. I want to copy rows A1 to H1 and
transpose them into a single column (e.g. column N)then take the values
in A2 to H2 and transpose them into the same column underneath the
previously transposed column (N). What I am trying to achieve is to
take this table of data and turn it into a single serial string. Also
when the macro loop first starts it needs to check the column it is
transposing to (e.g. N) does not already have data in it, if it does
then it needs to transpose to an adjacent column.

Narly...yes?? Any help very much appreciated


Cheers

Simon


--
simonsmith
------------------------------------------------------------------------
simonsmith's Profile: http://www.excelforum.com/member.php...o&userid=34235
View this thread: http://www.excelforum.com/showthread...hreadid=539963

  #2   Report Post  
Posted to microsoft.public.excel.misc
Tim M
 
Posts: n/a
Default loop bunny needs help

Not sure if this will help but I had a similar situation a while back (when I
ran my macro it could not find the end of the previous data and thus I copied
over existing data.) A fellow responded to my problem with this reply (and
it worked for me)

'Tim,

Every place where you have

Selection.End(xlDown).Select
Range("?28").Select

Change it to

Selection.End(xlDown)(2).Select


"simonsmith" wrote:


Hi,
Can anybody help me with this little beauty? I am a first time loop guy
so not sure what to do here... I have a table of data 8 columns wide and
normally 40 rows high. I want to copy rows A1 to H1 and
transpose them into a single column (e.g. column N)then take the values
in A2 to H2 and transpose them into the same column underneath the
previously transposed column (N). What I am trying to achieve is to
take this table of data and turn it into a single serial string. Also
when the macro loop first starts it needs to check the column it is
transposing to (e.g. N) does not already have data in it, if it does
then it needs to transpose to an adjacent column.

Narly...yes?? Any help very much appreciated


Cheers

Simon


--
simonsmith
------------------------------------------------------------------------
simonsmith's Profile: http://www.excelforum.com/member.php...o&userid=34235
View this thread: http://www.excelforum.com/showthread...hreadid=539963


  #3   Report Post  
Posted to microsoft.public.excel.misc
Otto Moehrbach
 
Posts: n/a
Default loop bunny needs help

Simon
This macro will do what you want. As written, this macro will paste to
that column that is one column to the right of the last column that has an
entry in row 1.
In each row of your data, this macro will copy columns A:H. The number of
rows of data that you have is immaterial.
HTH Otto
Sub TransposeData()
Dim ColNum As Long
Dim RngColA As Range
Dim i As Range
Application.ScreenUpdating = False
ColNum = Range("IV1").End(xlToLeft).Offset(, 1).Column
Set RngColA = Range("A1", Range("A" & Rows.Count).End(xlUp))
For Each i In RngColA
Range(i, Cells(i.Row, 8)).Copy
If Cells(Rows.Count, ColNum).End(xlUp).Row = 1 Then
Cells(Rows.Count, ColNum).End(xlUp) _
.PasteSpecial Transpose:=True
Else
Cells(Rows.Count, ColNum).End(xlUp).Offset(1) _
.PasteSpecial Transpose:=True
End If
Next i
Application.ScreenUpdating = True
End Sub
"simonsmith" wrote
in message ...

Hi,
Can anybody help me with this little beauty? I am a first time loop guy
so not sure what to do here... I have a table of data 8 columns wide and
normally 40 rows high. I want to copy rows A1 to H1 and
transpose them into a single column (e.g. column N)then take the values
in A2 to H2 and transpose them into the same column underneath the
previously transposed column (N). What I am trying to achieve is to
take this table of data and turn it into a single serial string. Also
when the macro loop first starts it needs to check the column it is
transposing to (e.g. N) does not already have data in it, if it does
then it needs to transpose to an adjacent column.

Narly...yes?? Any help very much appreciated


Cheers

Simon


--
simonsmith
------------------------------------------------------------------------
simonsmith's Profile:
http://www.excelforum.com/member.php...o&userid=34235
View this thread: http://www.excelforum.com/showthread...hreadid=539963



  #4   Report Post  
Posted to microsoft.public.excel.misc
simonsmith
 
Posts: n/a
Default loop bunny needs help


Thanks Otto this works superbly - exactly as I was wanting it to and
gets rid of one of my major headaches. The other issue I have is I
need to collect this data from all of 30 worksheets (at starting point
B6 of each sheet) of a workbook x then put it into columns in a
separate workbook (or same workbook new sheet). No stress if you dont
want to answer this one. Thanks again


I owe you beer

Regards

Simon


--
simonsmith
------------------------------------------------------------------------
simonsmith's Profile: http://www.excelforum.com/member.php...o&userid=34235
View this thread: http://www.excelforum.com/showthread...hreadid=539963

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
Loop time seems dependent on unrelated workbook - Why? Richard Excel Worksheet Functions 2 March 31st 06 12:59 AM
Loop gone crazy Dave Peterson Excel Discussion (Misc queries) 4 December 16th 05 04:38 PM
Do Loop Noemi Excel Discussion (Misc queries) 0 December 8th 05 11:43 PM
Help with Do...Loop Noemi Excel Discussion (Misc queries) 1 December 7th 05 01:59 AM
VB for excel, how do I loop through code steve hobden via OfficeKB.com Excel Discussion (Misc queries) 2 June 9th 05 02:59 PM


All times are GMT +1. The time now is 07:45 AM.

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"