![]() |
Help on VBA Arrays
Hi, How do I extract all the numbers but not duplicate letters Eg I have a list in Excel using 2 columns. Column A and Column respectively _A___________B_ A 1 A 2 A 3 B 1 B 2 B 3 C 1 C 2 C 3 I would like to transpose it in the following using 4 Columns Eg _A__B__C__D_ A 1 2 3 B 1 2 2 C 1 2 3 My guess is that I have to use Arrays with for.. next loops but I a not sure how do I do that? Any help is very much appreciated. Thank -- Anne Mari ----------------------------------------------------------------------- Anne Marie's Profile: http://www.officehelp.in/member.php?userid=486 View this thread: http://www.officehelp.in/showthread.php?t=124487 Posted from - http://www.officehelp.i |
Help on VBA Arrays
Sub Test()
Dim iLastRow As Long Dim i As Long Dim rng As Range Dim iStart As Long iLastRow = Cells(Rows.Count, "A").End(xlUp).Row iStart = 1 For i = 2 To iLastRow If Cells(i, "A").Value = Cells(i - 1, "A").Value Then Cells(iStart, "A").End(xlToRight).Offset(0, 1).Value = _ Cells(i, "B").Value If rng Is Nothing Then Set rng = Rows(i) Else Set rng = Union(rng, Rows(i)) End If Else iStart = i End If Next i If Not rng Is Nothing Then rng.Delete End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Anne Marie" wrote in message ... Hi, How do I extract all the numbers but not duplicate letters Eg I have a list in Excel using 2 columns. Column A and Column B respectively _A___________B_ A 1 A 2 A 3 B 1 B 2 B 3 C 1 C 2 C 3 I would like to transpose it in the following using 4 Columns Eg _A__B__C__D_ A 1 2 3 B 1 2 2 C 1 2 3 My guess is that I have to use Arrays with for.. next loops but I am not sure how do I do that? Any help is very much appreciated. Thanks -- Anne Marie ------------------------------------------------------------------------ Anne Marie's Profile: http://www.officehelp.in/member.php?userid=4861 View this thread: http://www.officehelp.in/showthread.php?t=1244878 Posted from - http://www.officehelp.in |
All times are GMT +1. The time now is 12:09 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com