jeudi 21 janvier 2021

VBA: if statement for ranges in two separate worksheets

Sub Simple_if()

Dim score As Integer, i As Long

i = 1

Do While Worksheets("Business").cells(i, "D").Value

score = Worksheets("Business").cells(i, "D").Value

If score >= 3 Then

Worksheets("Engagement Plan").cells(i, "A4").Value = Worksheets("Business").cells(i, "C").Value


End If
i = i + 1

Loop

End Sub

I'm facing difficulties getting my VBA script to work. So I have a column filled with numbers ranging from 1-4 and another column with company names in the same worksheet. I'm interested in having an other worksheet where I only see campanies with a number of 3 or greater. Therefore, I wanted to make an IF statement that could do this, due to having a large and continously changing database. However, I keep getting an error for my proposed script.

I hope there is someone that can help me with this.

Aucun commentaire:

Enregistrer un commentaire