Results 1 to 2 of 2

Thread: Solved: How to test formulas results?

  1. #1
    VBAX Regular
    Mar 2013

    Unhappy Solved: How to test formulas results?

    Hello. My question is probably very basic: I am learning bymyself VBA and I am having trouble to work with the results of a formula.

    example I've already used...
    If WorksheetFunction.IsNA(Cells(Go, 20)) Then...

    How to test the same way if a cell is blank or for example =6?

    In this examples,
    cells(Go,20) is either blank or contains a formula returning a text.
    cells(Go,21) is either blank or contains a formula returning a value

    To make it work, I had to first copy/paste as value the result of the formula calculation, but I am sure I could skip this step.


    [VBA]While Go < Lignes
    Go = Go + 1
    If Cells(Go, 20) <> "" Then
    If Cells(Go, 21) > 0 Then
    End If
    ElseIf Cells(Go, 21) = Cells(Go,3) Then
    End If
    Last edited by Aussiebear; 03-26-2013 at 03:58 AM. Reason: added the correct tags to the supplied code

  2. #2
    Knowledge Base Approver VBAX Guru
    Apr 2012
    To test whether a cell is empty or not

    if cells(1,1)="" Then.....
    If Cells(1,1).Value="" Then ...
    if Isempty(cells(1,1)) Then ...
    If cells(1,1) <>"" Then ...
    If Cells(1,1).Value <>"" Then ...
    If not Isempty(cells(1,1)) Then ...

    To test the value of a cell:

    If Cells(1,1)=5 Then ...
    if Cells(1,1).Value= 5 Then ....
    If Cells(1,1)="text" Then ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts