Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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



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
Regarding Arrays Raj Excel Discussion (Misc queries) 5 December 10th 08 03:51 PM
Working with ranges in arrays... or an introduction to arrays Glen Excel Programming 5 September 10th 06 08:32 AM
Arrays - declaration, adding values to arrays and calculation Maxi[_2_] Excel Programming 1 August 17th 06 04:13 PM
Can I do this with arrays? Ed Excel Programming 7 January 11th 06 05:46 PM
Arrays Dani Excel Programming 1 June 7th 05 05:28 PM


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