Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Kenneth Bennett   on Jan 11 In MS Office Category.

  
Question Answered By: Fadiyah Khan   on Jan 11

Thank you for your reply and explanation of how String checks
numbers. Being self taught from reading books and help  files I have
never come across that before. I knew the String data type was for
text but had never seen how it handles numbers explaned. Can you
point me to a link that will explain that in more detail?

I took your suggesttion and tried two different data types ( Integer
and Single)and i can still not get it to work.

Dim PrevLowVal As Integer

Function CheckLowVal(Val As Integer) As Integer
If val  <> "" Then
If PrevLowVal = "" Then
PrevLowVal = 1000
MsgBox PrevLowVal & " PrevLowVal 1"
End If
MsgBox PrevLowVal & " PrevLowVal 2"
MsgBox Val & " Val A"

If Val < PrevLowVal Then
PrevLowVal = Val
MsgBox PrevLowVal & " PrevLowVal 3"
End If
MsgBox Val & " Val B"
MsgBox PrevLowVal & " PrevLowVal 4"

End If
End Function




Dim PrevLowVal As Single

Function CheckLowVal(Val As Single) As Integer
If Val <> "" Then
If PrevLowVal = "" Then
PrevLowVal = 1000
MsgBox PrevLowVal & " PrevLowVal 1"
End If
MsgBox PrevLowVal & " PrevLowVal 2"
MsgBox Val & " Val A"

If Val < PrevLowVal Then
PrevLowVal = Val
MsgBox PrevLowVal & " PrevLowVal 3"
End If
MsgBox Val & " Val B"
MsgBox PrevLowVal & " PrevLowVal 4"

End If
End Function


Also regarding your suggestion to use the Min Function. i would be
interested in trying that but am not sure how to do it. i checked
the VBA built in functions and could not locate a Min function. So
either I am not looking in the right place or you are referring to
using the Excel worksheet function  with the WorkSheetFunction
Object. I would use that but I don't know how to get it to do what i
want.

The variable  Val in my CheckLowVal Function will be changing  very
rapidly and I need to determine which value was the lowest number. I
am not quite sure how to create a set  in this situation and also the
help on the excel Min function say that it handles values between 1-
30. i anticipate having more than 30 value changes. If I am not
looking at this correctly any help would be appreciated.

Share: 

 

This Question has 13 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Help with Value in a Variable Or get search suggestion and latest updates.


Tagged: