Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default output of associated arrays

I have the following arrays

arrName()
arrNumber()

Each item in arrNumber() is associated with a particular arrName(). I'm
currently using a For...Next loop to output the results on a spreadsheet, as
follows:

For y = 1 To Size
Cells(y, 4).Value = arrName(Number(y))
Cells(y, 5).Value = arrNumber(Number(y))
Next y

So the output looks like this:

Name1 1
Name1 2
Name1 3
Name2 4
Name2 5

I'm trying to figure out if I can make my output look something like this:

Name1
1
2
3
Name2
4
5

I've tried using nested loops of various types, but I'm just not getting it.
This doesn't affect the functionality of the output, but I'd like to make it
"pretty" (people are impressed with pretty!).

TIA
Mike

--
Michael J. Malinsky



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default output of associated arrays

Hi Mike,

You could try below... or use pivot table's auto format
report feature...
------------------------
Sub RemoveSame()

Dim i As Integer

For i = 2 To ActiveSheet.UsedRange.Rows.Count

If Cells(i, "A") = Cells(i - 1, "A") Then Rows
(i).EntireRow.Delete

Next i

End Sub
------------------------
Hope this helps...

Chong Moua

-----Original Message-----
I have the following arrays

arrName()
arrNumber()

Each item in arrNumber() is associated with a particular

arrName(). I'm
currently using a For...Next loop to output the results

on a spreadsheet, as
follows:

For y = 1 To Size
Cells(y, 4).Value = arrName(Number(y))
Cells(y, 5).Value = arrNumber(Number(y))
Next y

So the output looks like this:

Name1 1
Name1 2
Name1 3
Name2 4
Name2 5

I'm trying to figure out if I can make my output look

something like this:

Name1
1
2
3
Name2
4
5

I've tried using nested loops of various types, but I'm

just not getting it.
This doesn't affect the functionality of the output, but

I'd like to make it
"pretty" (people are impressed with pretty!).

TIA
Mike

--
Michael J. Malinsky



.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default output of associated arrays

Michael,

Have you tried checking for a change in the name value before writing it out
to the sheet.

Dim TempName as string 'Local variable

For y = 1 To Size
if TempName < arrName(Number(y)) then 'Test to see if we have
hit a new name
Cells(y, 4).Value = arrName(Number(y)) 'If this is a new
name write it to the sheet
TempName = arrName(Number(y)) 'Now reload the
tempname variable for the next leg
end if
Cells(y, 5).Value = arrNumber(Number(y))

Next y



"Michael J. Malinsky" wrote in message
...
I have the following arrays

arrName()
arrNumber()

Each item in arrNumber() is associated with a particular arrName(). I'm
currently using a For...Next loop to output the results on a spreadsheet,

as
follows:

For y = 1 To Size
Cells(y, 4).Value = arrName(Number(y))
Cells(y, 5).Value = arrNumber(Number(y))
Next y

So the output looks like this:

Name1 1
Name1 2
Name1 3
Name2 4
Name2 5

I'm trying to figure out if I can make my output look something like this:

Name1
1
2
3
Name2
4
5

I've tried using nested loops of various types, but I'm just not getting

it.
This doesn't affect the functionality of the output, but I'd like to make

it
"pretty" (people are impressed with pretty!).

TIA
Mike

--
Michael J. Malinsky





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default output of associated arrays

Sorry.. use ClearContents instead...
-------------------------
Sub RemoveSame()

Dim i As Integer

For i = 2 To ActiveSheet.UsedRange.Rows.Count

If Cells(i, "A") = Cells(i - 1, "A") Then Cells
(i, "A").ClearContents

Next i

End Sub
-------------------------
Chong Moua

-----Original Message-----
Hi Mike,

You could try below... or use pivot table's auto format
report feature...
------------------------
Sub RemoveSame()

Dim i As Integer

For i = 2 To ActiveSheet.UsedRange.Rows.Count

If Cells(i, "A") = Cells(i - 1, "A") Then Rows
(i).EntireRow.Delete

Next i

End Sub
------------------------
Hope this helps...

Chong Moua

-----Original Message-----
I have the following arrays

arrName()
arrNumber()

Each item in arrNumber() is associated with a particular

arrName(). I'm
currently using a For...Next loop to output the results

on a spreadsheet, as
follows:

For y = 1 To Size
Cells(y, 4).Value = arrName(Number(y))
Cells(y, 5).Value = arrNumber(Number(y))
Next y

So the output looks like this:

Name1 1
Name1 2
Name1 3
Name2 4
Name2 5

I'm trying to figure out if I can make my output look

something like this:

Name1
1
2
3
Name2
4
5

I've tried using nested loops of various types, but I'm

just not getting it.
This doesn't affect the functionality of the output, but

I'd like to make it
"pretty" (people are impressed with pretty!).

TIA
Mike

--
Michael J. Malinsky



.

.

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
Need help for getting output balurrpr Excel Discussion (Misc queries) 2 April 15th 10 10:12 AM
What 'value' is a Dec2Bin output? EvilTony Excel Discussion (Misc queries) 12 April 13th 09 01:59 PM
Need Help on formal - output a sum Deiow Excel Worksheet Functions 3 July 26th 08 05:59 AM
Please help with report output! 49niner Excel Worksheet Functions 2 March 13th 08 08:41 PM
VBA - Function Output Jeff Excel Discussion (Misc queries) 2 March 30th 07 07:53 PM


All times are GMT +1. The time now is 11:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"