Do loop and 2 if statements

Linda21

New Member
Joined
Aug 2, 2010
Messages
38
Hello,

I simply want to loop through rows in a set range. If Column 9 has an * and Column C has any kind of value, change the value to a 5. I can't get this to work. Am I doing the if statement wrong. Thank you.

Sub ConvertX()
StartRow = 42
EndRow = 68
ConvertibleCode = 9 ' column I
Rating5 = 3 'column C
UpdateCell = Critical_Skills.Cells(StartRow, Rating5)
ConvertCell = Critical_Skills.Cells(StartRow, ConvertibleCode)
Do Until StartRow = EndRow
If UpdateCell <> "" And ConvertCell = "*" Then
UpdateCell = "5" 'update cell if there is a value and *
End If
StartRow = StartRow + 1 ' increase row to search for non blank cells

If StartRow = EndRow Then Exit Do
Loop

End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,224,532
Messages
6,179,388
Members
452,908
Latest member
MTDelphis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top