Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() Please follow following steps 1.Right Click toolbarclick control box 2.From control box select a command button and draw it to your sheet 3.Double click the command button to open code window and paste following codes Private Sub CommandButton1_Click() Dim row As Integer, col As Integer, cnt As Integer row = 1 col = 1 cnt = 1 While Sheet1.Cells(row, col).Value < "" cnt = chkRepeat(Sheet1.Cells(row, col).Value, row) Sheet1.Cells(row, col + 1).Value = cnt row = row + 1 Wend End Sub Private Function chkRepeat(str As String, i As Integer) As Integer Dim tmp As Integer tmp = 1 Dim row As Integer, col As Integer row = 1 col = 1 While Sheet1.Cells(row, col).Value < "" If i < row Then If Sheet1.Cells(row, col).Value = str Then tmp = tmp + 1 End If End If row = row + 1 Wend chkRepeat = tmp End Function Now on clicking the button you get the number of counts listed in column B Have a nice time…. Chris ------ Convert your Excel spreadsheet into an online calculator. http://www.spreadsheetconverter.com -- Chris Bode |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple Criteria, Count If, Sum Product to get count across range | Excel Worksheet Functions | |||
Count Employee Work Time - Don't Double-count Overlapping Apts. | Excel Worksheet Functions | |||
Excel 2000, count, sort a list & count totals? | Excel Worksheet Functions | |||
Count Intervals of 2 Consecutive Values in same Row and Return Count across Row | Excel Worksheet Functions | |||
Count Intervals of Filtered TEXT values in Column and Return Count across a Row | Excel Worksheet Functions |