Correct Expression for Evaluating and Integer Variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DeerGuy
    New Member
    • Jul 2006
    • 6

    Correct Expression for Evaluating and Integer Variable

    This is a really, really simple question, but I so new to VBA, that I have to ask.

    I have an integer variable that I want to perform some actions on depending upon its value.

    Is the following expression valid for testing to see if an integer variable has a missing value

    If HarvestMonth.Va lue = "" Then
    'Take some action
    end if


    Since the double quotes "" are used for String variables, I wasn't sure the same would apply to integers. Sorry for the really simple question.

    I've got "Mastering VBA" on my desk and I can't find the answer there. If you would like to recommend additional reading, please feel free.

    Mike
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    Hi there

    Dim SomeVariable As Integer

    the DIM keyword is used the declare a variable.. in the case above the SomeVariable will hold an integer value..

    Code:
      If HarvestMonth.Value = "" Then
       'Take some action
      EndIf
    OR

    Code:
      If HarvestMonth.Value > x HarvestMonth.Value < x Then
       'Take some action
      EndIf
    well.. in VB or VBA.. you can make use of the mathematical operator to perform some basic calculation.. i.e. <>, > < = >= <=.. good luck my fren.. :) hoping to hear from you soon regarding another question.. :)

    Comment

    • DeerGuy
      New Member
      • Jul 2006
      • 6

      #3
      Thank you very much!


      Originally posted by sashi
      Hi there

      Dim SomeVariable As Integer

      the DIM keyword is used the declare a variable.. in the case above the SomeVariable will hold an integer value..

      Code:
        If HarvestMonth.Value = "" Then
         'Take some action
        EndIf
      OR

      Code:
        If HarvestMonth.Value > x HarvestMonth.Value < x Then
         'Take some action
        EndIf
      well.. in VB or VBA.. you can make use of the mathematical operator to perform some basic calculation.. i.e. <>, > < = >= <=.. good luck my fren.. :) hoping to hear from you soon regarding another question.. :)

      Comment

      • sashi
        Recognized Expert Top Contributor
        • Jun 2006
        • 1749

        #4
        Hi there,

        anytime buddy.. take care and care a great day ahead.. good luck my fren.. :)

        Comment

        Working...