View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
sip8316 sip8316 is offline
external usenet poster
 
Posts: 18
Default Application.Mode

I am creating a spreadsheet that Loops through a series of continuous row,
assiging a variant variable, V(i), a specific value based on the text within
the respective cell. I then want to take the mode of all V(i) values. I
have already set up the code so it will set v(i) and tested it so I know it
works but when I try to calculate the mode I get errors.

I have tried using cells(1,1).value=application.mode(v) and
cells(1,1)=application.mode(v) but it always returns a #N/A in the cell. Is
there a different function I should be using? Below is some example of my
code:


Dim V() as variant

Select Case LCase(cell.Text)
Case "once a month"
V(i) = 0.25
Case "one time a month"
V(i) = 0.25
Case Else
If Application.CountA(cell.Resize(1, 5)) = 0 Then
V(i) = False
Else
V(i) = Application.CountA(cell.Resize(1, 5))
End If
End Select

Cells(CurrentRow + 2, CurrentColumn) = Application.Mode(V)
Cells(CurrentRow + 2, CurrentColumn).Resize(1, 5).Merge


Thanks for the Help,

Scott