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

Hi,

XL 2K

I have an list of names and addresses in column A that finishes in Row
56500.
The format is not consistent, with names/addresses ranging from 3 - 6
rows.
A blank row separates each name/address.

The format looks something like this:

Row 1 : Name
Row 2 : Address1 line 1
Row 3 : Address1 line 2
Row 4 : Blank
Row 5 : Name
Row 6 : Address2 line 1
Row 7 : Address2 line 2
Row 8 : Address2 line 3
Row 9 : Blank
Row 10 : Name
Row 11 : Address1 line 1
Row 12 : Address1 line 2
Row 13 : Blank
etc


Is it possible to loop through the range in Col A for each
name/address and then transpose into Cols B:D, B:E, B:F, or B:F
(dependent on the number of rows in the name/address in Col A).

TIA

Cheers

Bob
Maitland Australia

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Transpose Dynamic Ranges

Hi
try the following macro:

Sub transpose_data()
Dim lastrow As Long
Dim row_index As Long
Dim trow As Long
Dim tcol As Integer
Dim source_wks As Worksheet
Dim target_wks As Worksheet

Set source_wks = Worksheets("sheet1")
Set target_wks = Worksheets("sheet2")
lastrow = source_wks.Cells(Rows.Count, 1).End(xlUp).Row
trow = 1
tcol = 1
Application.ScreenUpdating = False
For row_index = 1 To lastrow
If source_wks.Cells(row_index, 1).Value < "" Then
target_wks.Cells(trow, tcol).Value = _
source_wks.Cells(row_index, 1).Value
tcol = tcol + 1
Else
tcol = 1
trow = trow + 1
End If
Next
Application.ScreenUpdating = False
End Sub

-----Original Message-----
Hi,

XL 2K

I have an list of names and addresses in column A that

finishes in Row
56500.
The format is not consistent, with names/addresses

ranging from 3 - 6
rows.
A blank row separates each name/address.

The format looks something like this:

Row 1 : Name
Row 2 : Address1 line 1
Row 3 : Address1 line 2
Row 4 : Blank
Row 5 : Name
Row 6 : Address2 line 1
Row 7 : Address2 line 2
Row 8 : Address2 line 3
Row 9 : Blank
Row 10 : Name
Row 11 : Address1 line 1
Row 12 : Address1 line 2
Row 13 : Blank
etc


Is it possible to loop through the range in Col A for each
name/address and then transpose into Cols B:D, B:E, B:F,

or B:F
(dependent on the number of rows in the name/address in

Col A).

TIA

Cheers

Bob
Maitland Australia

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Transpose Dynamic Ranges

Many thanks Frank,

Works great.

Cheers

Bob

On Tue, 27 Jul 2004 00:12:46 -0700, "Frank Kabel"
wrote:

Hi
try the following macro:

Sub transpose_data()
Dim lastrow As Long
Dim row_index As Long
Dim trow As Long
Dim tcol As Integer
Dim source_wks As Worksheet
Dim target_wks As Worksheet

Set source_wks = Worksheets("sheet1")
Set target_wks = Worksheets("sheet2")
lastrow = source_wks.Cells(Rows.Count, 1).End(xlUp).Row
trow = 1
tcol = 1
Application.ScreenUpdating = False
For row_index = 1 To lastrow
If source_wks.Cells(row_index, 1).Value < "" Then
target_wks.Cells(trow, tcol).Value = _
source_wks.Cells(row_index, 1).Value
tcol = tcol + 1
Else
tcol = 1
trow = trow + 1
End If
Next
Application.ScreenUpdating = False
End Sub

-----Original Message-----
Hi,

XL 2K

I have an list of names and addresses in column A that

finishes in Row
56500.
The format is not consistent, with names/addresses

ranging from 3 - 6
rows.
A blank row separates each name/address.

The format looks something like this:

Row 1 : Name
Row 2 : Address1 line 1
Row 3 : Address1 line 2
Row 4 : Blank
Row 5 : Name
Row 6 : Address2 line 1
Row 7 : Address2 line 2
Row 8 : Address2 line 3
Row 9 : Blank
Row 10 : Name
Row 11 : Address1 line 1
Row 12 : Address1 line 2
Row 13 : Blank
etc


Is it possible to loop through the range in Col A for each
name/address and then transpose into Cols B:D, B:E, B:F,

or B:F
(dependent on the number of rows in the name/address in

Col A).

TIA

Cheers

Bob
Maitland Australia

.


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
array transpose for dynamic data without macros Rad131304 Excel Discussion (Misc queries) 7 February 18th 10 10:48 PM
Help with dynamic ranges JoAnn New Users to Excel 2 March 25th 08 03:19 PM
dynamic transpose BorisS Excel Discussion (Misc queries) 1 September 23rd 06 12:49 PM
Dynamic Formulas with Dynamic Ranges Ralph Howarth Excel Worksheet Functions 5 January 21st 05 08:44 AM
Transpose dynamic range Michael Beckinsale Excel Programming 3 March 5th 04 04:03 PM


All times are GMT +1. The time now is 01:41 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"