View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jclark419 jclark419 is offline
external usenet poster
 
Posts: 1
Default Function working on whim


Hey everyone, first post here. Trying to figure out why a function I
have written will work in one cell and not the other. In the case of
what I have written, what row the active cell is should not matter but
the active cell's column does. It should read a value from a specified
row in that column and then perform a simple comparison.

My issue is that while in the same column the function will work for
one row but not the 2 above it, after those two it begins working
again. What have I done to cause this to happen?

Here is the code: (simplistic I know but I started learning VBA
yesterday)


Code:
--------------------
Option Explicit

Public Function eb(additive2 As Integer) As Double

Dim count As Integer

additive2 = Application.ThisWorkbook.Worksheets("Results").Cel ls(6, Application.ActiveCell.Column).Value

eb = 0

count = 6

For count = 6 To 10
If Application.ThisWorkbook.Worksheets("Additive-Flush").Cells(count, 8).Value = additive2 Then
eb = Application.ThisWorkbook.Worksheets("Additive-Flush").Cells(count, 14).Value + eb
Else
eb = eb + 0
End If
Next count

End Function

--------------------


Thank you for your help.

~Jason


--
jclark419
------------------------------------------------------------------------
jclark419's Profile: http://www.excelforum.com/member.php...o&userid=25430
View this thread: http://www.excelforum.com/showthread...hreadid=388828