Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This macro appears to do what you asked for...
Sub AlignColumnData() Dim M As Long, D As Long, Rw As Long, Main As Variant, Data As Variant With WorksheetFunction Main = .Transpose(Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)) Data = .Transpose(Range("B1:B" & Cells(Rows.Count, "B").End(xlUp).Row)) End With Range("A:B").Clear M = LBound(Main) D = LBound(Data) Do While M + D <= UBound(Main) + UBound(Data) Rw = Rw + 1 If Main(M) = Data(D) Then Range("A" & Rw).Resize(1, 2).Value = Main(M) M = M + 1 D = D + 1 ElseIf Main(M) < Data(D) Then Range("A" & Rw).Value = Main(M) M = M + 1 Else Range("A" & Rw).Offset(0, 1).Value = Data(D) D = D + 1 End If Loop End Sub Rick Rothstein (MVP - Excel) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I align numbers in different cells when some are in bracke. | Excel Discussion (Misc queries) | |||
ALIGN DATA CELLS? | Excel Discussion (Misc queries) | |||
Align matching cells of two different columns | Excel Worksheet Functions | |||
how to align vertical cells horizontally | New Users to Excel | |||
How do I align cells in Excel onto one line? | Excel Worksheet Functions |