View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ghh3rd ghh3rd is offline
external usenet poster
 
Posts: 1
Default Output array to Excel blank rows separating groups


I've got an array which I'd like to group while writing it to Excel b
inserting a blank row above (and below) any groups of repeating value
in Col "A". Determining the locations for the bottom blank row i
easy, it's the top row that I'm having a problem with.

Any tips? Here's my test code to replicate what I want to do:



Code
-------------------
Function tester()
Dim IDCount
Dim IDHold
Dim i
IDCount = 0
IDHold = ""
Dim ID
Dim IDS As Variant

ID = ""
IDS = Array("A", "A", "B", "B", "C", "D", "E", "F", "F", "G")

For i = 1 To 10
ID = IDS(i)
'IDCount = IDCount + 1
If ID < IDHold Then
If IDCount 1 Then
'MsgBox "EXTRA ROW INSERTED"
Debug.Print ""
IDCount = 0
End If
End If
Debug.Print "ID: " & ID & " " & "IDHOLD: " & IDHold & " " & "IDCOUNT: " & IDCount
IDHold = ID
IDCount = IDCount + 1
Next i
End Function
-------------------



Thanks,

Rand

--
ghh3r
-----------------------------------------------------------------------
ghh3rd's Profile: http://www.excelforum.com/member.php...fo&userid=3204
View this thread: http://www.excelforum.com/showthread.php?threadid=51797