Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default count uniques in same column, post in blank cell, repeat until end ofspreadsheet

A macro that fills the next blank row in same column as represented
below.

Column A
A
A
A
N
N
N
N
[blank cell] result should be "2" - keep going
A
A
J
L
F
F
F
[blank cell] result should be "4"- keep going until you get to the
end of the spreadsheet.




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default count uniques in same column, post in blank cell, repeat until end of spreadsheet

Public Sub ProcessData()
Dim i As Long
Dim LastRow As Long
Dim StartRow As Long

With ActiveSheet

LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
StartRow = 1
For i = 2 To LastRow + 1

If .Cells(i, "A").Value = "" Then

.Cells(i, "A").Formula = "=SUMPRODUCT((A" & StartRow & ":A"
& i - 1 & "< """")/" & _
"COUNTIF(A" & StartRow & ":A" & i -
1 & ",A" & StartRow & ":A" & i - 1 & "&""""))"
StartRow = i + 1
End If
Next i

End With

End Sub

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"S Himmelrich" wrote in message
...
A macro that fills the next blank row in same column as represented
below.

Column A
A
A
A
N
N
N
N
[blank cell] result should be "2" - keep going
A
A
J
L
F
F
F
[blank cell] result should be "4"- keep going until you get to the
end of the spreadsheet.






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,344
Default count uniques in same column, post in blank cell, repeat until end

Hi,

Here is another solution:

Sub Macro1()
Dim B as Long, S, E, A
B = [A65536].End(xlUp).Row
S = ActiveCell.Address
Do
Do Until ActiveCell = ""
ActiveCell.Offset(1, 0).Select
E = ActiveCell.Offset(-1, 0).Address
Loop
A = S & ":" & E
Selection = Evaluate("SUM(1/Countif(" & A & "," & A & "))")
S = ActiveCell.Offset(1, 0).Address
Loop Until Range(E).Row = B
End Sub


--
Cheers,
Shane Devenshire


"S Himmelrich" wrote:

A macro that fills the next blank row in same column as represented
below.

Column A
A
A
A
N
N
N
N
[blank cell] result should be "2" - keep going
A
A
J
L
F
F
F
[blank cell] result should be "4"- keep going until you get to the
end of the spreadsheet.





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
Count Uniques in Column, put result in next blank cell andcontinue until last row merjet Excel Programming 2 January 15th 08 05:31 PM
Count Uniques in Column, put result in next blank cell and continu ryguy7272 Excel Programming 1 January 15th 08 05:29 PM
Repeat entries in rows 5 & 6 into next blank column manfareed Excel Programming 7 October 5th 07 08:40 AM
Count blank cell in a column shantanu Excel Programming 2 April 5th 07 04:28 AM
Count Uniques within a list based on value of cell... MeatLightning Excel Discussion (Misc queries) 3 March 20th 06 05:21 PM


All times are GMT +1. The time now is 07:15 PM.

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"