Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default macro to transpose cells in Column B based on unique values in Column A

Greetings,

As a less-than-subtle disclaimer, I am a newcomer to VBA programming,
and I apologize for not having had the time to look into my (fairly
pressing) problem much on my own before casting this general inquiry
to the forum:

Does anyone know of a macro that would allow me to iteratively
transpose series of cells in one column as based unique values in
another column? As an example, I need to get from this:

A B
1 17
1 90
1 96
1 6
2 12
2 10

to this:

A B C D E
1 17 90 96 6
2 12 10

where column A contains the unique values by which values in column B
are transposed.

(My spreadsheet contains thousands of rows. There would be enough
columns for the transpositions, however, because no more than 256
instances occur for any given value in column A.)

In lieu of an extant macro that would do this, I would, of course, be
interested to know if anyone could help me determine what other code I
might attempt to patch together toward this end.

Any help or ideas on this would, of course, be most appreciated!

Aaron J.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default macro to transpose cells in Column B based on unique values in Column A

Aaron,
Try this macro
Cecil

Sub MacroToFilter()
Dim LRow As Long
Dim LRowU As Long
Dim i As Long
Dim crit As String
Application.ScreenUpdating = False
LRow = Range("A" & Rows.Count).End(xlUp).Row
Range("A1:A" & LRow).AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Range("C1"), Unique:=True
LRowU = Range("C" & Rows.Count).End(xlUp).Row
For i = 2 To LRowU
crit = Range("C" & i).Value
Range("A1:B" & LRow).AutoFilter Field:=1, _
Criteria1:=crit
With Range("B2:B" & LRow)
.SpecialCells(xlCellTypeVisible).Copy
Range("D" & i).PasteSpecial _
Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
End With
Application.CutCopyMode = False
Next i
Range("A1:B" & LRow).AutoFilter
Application.ScreenUpdating = True
End Sub

"Aaron J." wrote in message
om...
Greetings,

As a less-than-subtle disclaimer, I am a newcomer to VBA programming,
and I apologize for not having had the time to look into my (fairly
pressing) problem much on my own before casting this general inquiry
to the forum:

Does anyone know of a macro that would allow me to iteratively
transpose series of cells in one column as based unique values in
another column? As an example, I need to get from this:

A B
1 17
1 90
1 96
1 6
2 12
2 10

to this:

A B C D E
1 17 90 96 6
2 12 10

where column A contains the unique values by which values in column B
are transposed.

(My spreadsheet contains thousands of rows. There would be enough
columns for the transpositions, however, because no more than 256
instances occur for any given value in column A.)

In lieu of an extant macro that would do this, I would, of course, be
interested to know if anyone could help me determine what other code I
might attempt to patch together toward this end.

Any help or ideas on this would, of course, be most appreciated!

Aaron J.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default macro to transpose cells in Column B based on unique values in Column A

Cecil,

Your code worked exquisitely!

(The first node-to-node adjacency needed to be manually re-inserted
into the output, but that's far beside the point -- you've spared me
long hours of Sisyphusian tedium.) Thankyou, as well as for being so
quick in responding to my inquiry.

My sincere gratitude,
Aaron J.



"Cecilkumara Fernando" <cekufdo@sltnetDOTlk wrote in message ...
Aaron,
Try this macro
Cecil

Sub MacroToFilter()
Dim LRow As Long
Dim LRowU As Long
Dim i As Long
Dim crit As String
Application.ScreenUpdating = False
LRow = Range("A" & Rows.Count).End(xlUp).Row
Range("A1:A" & LRow).AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Range("C1"), Unique:=True
LRowU = Range("C" & Rows.Count).End(xlUp).Row
For i = 2 To LRowU
crit = Range("C" & i).Value
Range("A1:B" & LRow).AutoFilter Field:=1, _
Criteria1:=crit
With Range("B2:B" & LRow)
.SpecialCells(xlCellTypeVisible).Copy
Range("D" & i).PasteSpecial _
Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
End With
Application.CutCopyMode = False
Next i
Range("A1:B" & LRow).AutoFilter
Application.ScreenUpdating = True
End Sub

"Aaron J." wrote in message
om...
Greetings,

As a less-than-subtle disclaimer, I am a newcomer to VBA programming,
and I apologize for not having had the time to look into my (fairly
pressing) problem much on my own before casting this general inquiry
to the forum:

Does anyone know of a macro that would allow me to iteratively
transpose series of cells in one column as based unique values in
another column? As an example, I need to get from this:

A B
1 17
1 90
1 96
1 6
2 12
2 10

to this:

A B C D E
1 17 90 96 6
2 12 10

where column A contains the unique values by which values in column B
are transposed.

(My spreadsheet contains thousands of rows. There would be enough
columns for the transpositions, however, because no more than 256
instances occur for any given value in column A.)

In lieu of an extant macro that would do this, I would, of course, be
interested to know if anyone could help me determine what other code I
might attempt to patch together toward this end.

Any help or ideas on this would, of course, be most appreciated!

Aaron J.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default macro to transpose cells in Column B based on unique values in Column A

Cecil,

Your code worked exquisitely! - My sincere gratitude.

Thankyou as well as for responding so quickly to my inquiry.

Aaron

"Cecilkumara Fernando" <cekufdo@sltnetDOTlk wrote in message ...
Aaron,
Try this macro
Cecil

Sub MacroToFilter()
Dim LRow As Long
Dim LRowU As Long
Dim i As Long
Dim crit As String
Application.ScreenUpdating = False
LRow = Range("A" & Rows.Count).End(xlUp).Row
Range("A1:A" & LRow).AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Range("C1"), Unique:=True
LRowU = Range("C" & Rows.Count).End(xlUp).Row
For i = 2 To LRowU
crit = Range("C" & i).Value
Range("A1:B" & LRow).AutoFilter Field:=1, _
Criteria1:=crit
With Range("B2:B" & LRow)
.SpecialCells(xlCellTypeVisible).Copy
Range("D" & i).PasteSpecial _
Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
End With
Application.CutCopyMode = False
Next i
Range("A1:B" & LRow).AutoFilter
Application.ScreenUpdating = True
End Sub

"Aaron J." wrote in message
om...
Greetings,

As a less-than-subtle disclaimer, I am a newcomer to VBA programming,
and I apologize for not having had the time to look into my (fairly
pressing) problem much on my own before casting this general inquiry
to the forum:

Does anyone know of a macro that would allow me to iteratively
transpose series of cells in one column as based unique values in
another column? As an example, I need to get from this:

A B
1 17
1 90
1 96
1 6
2 12
2 10

to this:

A B C D E
1 17 90 96 6
2 12 10

where column A contains the unique values by which values in column B
are transposed.

(My spreadsheet contains thousands of rows. There would be enough
columns for the transpositions, however, because no more than 256
instances occur for any given value in column A.)

In lieu of an extant macro that would do this, I would, of course, be
interested to know if anyone could help me determine what other code I
might attempt to patch together toward this end.

Any help or ideas on this would, of course, be most appreciated!

Aaron J.

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
How can I number rows based on unique values in another column? Carla Excel Worksheet Functions 4 January 7th 10 06:03 AM
Count Unique Values in 1 Column based on Date Range in another Column Brian Excel Worksheet Functions 14 May 17th 09 02:58 PM
Total cells of one column based on the values in another column? Riccol New Users to Excel 10 February 1st 09 09:07 AM
Count unique values in 1 column where cells in another show non-bl Sarah (OGI) Excel Discussion (Misc queries) 4 October 17th 08 04:25 AM
Transpose unique values in one column/mult. rows into a single row Wil Excel Worksheet Functions 1 May 22nd 05 08:52 AM


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