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

Copy data based on multiple if statements

I am getting a run time error ‘438’: object doesn’t support this property or method on the IF statements.
I am trying to copy data from one sheet to another given if all 4 if statements are met.

Sub update_cell1()

Dim lRow As Long

lRow = Cells(Rows.Count, 1).End(xlUp).Row

For i = 3 To lRow
   If Worksheets("TEST").Cells(i, 5).vlaue = Worksheets("Cell_1").cell(1, 2).Value Then 'B1
        If Worksheets("TEST").Cells(i, 1).vlaue = Worksheets("Cell_1").cell(1, 1).Value Then 'A1
            If Worksheets("TEST").Cells(i, 6).vlaue <> "" Then 'not blank
                If Worksheets("TEST").Cells(i, 8).vlaue <> "" Then 'not blank
                
                    Worksheets("TEST").Rows(i).Copy
                    Worksheets("Cell_1").Active
                    b = 5
                    Worksheets("Cell_1").Cells(b + 1, 1).Select
                    ActiveSheet.Paste
                End If
            End If
        End If
      End If
    Next
    
Application.CutCopyMode = False
Worksheets("Cell_1").Active

End Sub

>Solution :

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

Worksheets(..).Cells(...).vlaue should be corrected to Worksheets(..).Cells(...).Value

Worksheets(..).cells(...) should be corrected to Worksheets(..).Cells(...)

In VBA, properties are case-sensitive. That means object.prop is different than object.Prop

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