Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88066

VBA if A = B and C= Text

$
0
0

I have been looking on stackoverflow but could not get an definitive answer to my little problem. I am fairly new to coding and am still dealing with syntax sometimes.

Right now I have a little loop reading an array, inside the loop it checks for an if statement. I have been checking the loop which works fine, and the array as well. The if statement works until im starting to use "isText".

After searching a bit I noticed "isText" is not a function, is there something equivalent?

Right now my if statement goes as follows: IF A = B and C (Contains ANY value at all) then Write something somewhere in a cell

Right now the code I am using is:

Sub KnopKlik()

Dim Soorten(10)
Dim Teller As Integer
Dim Column1 As String
Column1 = Sheets(2).Range("C1").Value

MsgBox (Column1)
Sheets(1).Select
Range("E2").Select

For Teller = 0 To 10
    Soorten(Teller) = ActiveCell.Offset(Teller).Value

Next Teller


For Teller = 0 To 10

If Sheets(2).Range("B9") = Soorten(Teller) And Application.IsText(Column1) Then

    MsgBox ("Check")
    Sheets(2).Range("E9").Value = ActiveCell.Offset(Teller, 3)
    Sheets(2).Select
    Range("B9").Select

    Teller = 10
    Else
End If


Next Teller

End Sub

Right now the last part of the if statement is the problem

And Application.IsText(Column1) Then

EDIT**

This is how I solved it now. Basically whenever there is ANYTHING at all in that cell it will pass through.

If Sheets(2).Range("B9") = Soorten(Teller) Then
'Als B9 Gelijk is aan (database) DAN!>>>
    If Not Column1 = "" Then
    Sheets(2).Range("E9").Value = ActiveCell.Offset(Teller, 3)
    End If
    Else
End If

Thanks in advance.


Viewing all articles
Browse latest Browse all 88066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>