Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

if then, also with third parameter

i have a macro running, who check the values in Column 5 and 4.
The Checking should be expand for one more check, if the results of the check from Column 5 and 4 is also positiv, there should be a check if the date value of the Column 6 is also available in the table tbl_Termine.
If this parameter is also positiv, there should be the Value "bei Termin entfernt" in the Cell of Column 7.

Sub ErgebnisEintragen()
For i = 2 To 13
If Cells(i, 5).Value > 0 And Cells(i, 4).Value = 0 Then
Cells(i, 7).Value = "entfernt"
End If
Next
End Sub

1

I hope you can understand my Question, and also you can help me!
Thanks a lot
Ă–.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

i dont know what i have to change, but the code until now is working.

>Solution :

Sub ErgebnisEintragen()
    Const TABLE_NAME = "tbl_Termine"
    Dim i As Long, c As Range
    For i = 2 To 13
        If Cells(i, 5).Value > 0 And Cells(i, 4).Value = 0 Then
            Set c = Range(TABLE_NAME).Find(Cells(i, 6).Value, , xlValues, xlWhole)
            If Not c Is Nothing Then Cells(i, 7).Value = "entfernt"
        End If
    Next
End Sub

OR

Sub ErgebnisEintragen()
    Const TABLE_NAME = "tbl_Termine"
    Dim arr, i As Long, c As Range
    Set c = Range(TABLE_NAME)
    For i = 2 To 13
        If Cells(i, 5).Value > 0 And Cells(i, 4).Value = 0 Then
            If Not VBA.IsError(Application.Match(Cells(i, 6), c, 0)) Then
                Cells(i, 7).Value = "entfernt"
            End If
        End If
    Next
End Sub
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading