View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Hardeep_kanwar[_2_] Hardeep_kanwar[_2_] is offline
external usenet poster
 
Posts: 103
Default multiple ranges, transposing?

Hi! Sir

I try your code but it is not work

Thanks

hardeep

"Héctor Miguel" wrote:

hi, !

are macros a valid alternate for this purpose ?... if so,

copy/paste the following into a standar code module in the vba editor
and run while "that" worksheets is the active sheet...

Sub Transpose_CarriesByVendor()
Application.ScreenUpdating = False
Dim Start As Long, nCols As Byte, nRow As Integer
With ActiveSheet
Worksheets.Add(After:=Worksheets(.Index)).Name = "Transposed"
.Range(.[a1], .[a65536].End(xlUp)).AdvancedFilter _
Action:=xlFilterCopy, CopyToRange:=[a1], Unique:=True
[a:a].Sort Key1:=[a2], Order1:=xlAscending, Header:=True
For nRow = 2 To [a65536].End(xlUp).Row
Start = Application.Match(Range("a" & nRow), .Range("a:a"), 0)
nCols = Application.CountIf(.Range("a:a"), Range("a" & nRow))
If nCols 1 Then
Range("b" & nRow).Resize(, nCols).Value = _
Application.Transpose(.Range("b" & Start).Resize(nCols).Value)
Else: Range("b" & nRow) = .Range("b" & Start)
End If
Next
End With
End Sub

hth,
hector.

__ OP __
I start with a list like this

company carries
101 INDUSTRIES BRASS
LIGHTING HOME NICKEL
FRANKFURT BRASS
FRANKFURT NICKEL
FRANKFURT STAINLESS
FRANKFURT COPPER
Jersey COPPER
Dallas NICKEL
Dallas STAINLESS
Dallas COPPER

I need to end up with a list like this
company carries
101 INDUSTRIES brass
LIGHTING HOME NICKEL
FRANKFURT BRASS NICKEL STAINLESS COPPER
Jersey COPPER
Dallas NICKEL STAINLESS COPPER

If it were just these few, I would insert some blanks and then transpose.
But my list is over 30,000 rows with a few thousand different companies.
I'm pretty new with this level of Excel and am about to bang my head with frustration.
Can someone help? Please!!