Compare Strings?

Santino_X

New Member
Joined
May 1, 2011
Messages
15
Good morning, I'm comparing a String from a cell with a given value but i can't make it work, this is the code

Sub Macroprota()

Dim ctotal As Integer, cposible As Integer, contador As Integer
For contador = 2 To 9551

If Right(Cells(contador, 6).Value, 3) = "c/3" Then
ctotal = Cells(contador, 15).Value * 2
ctotal = ctotal - Cells(contador, 12).Value
cposible = ctotal / 3
cposible = cposible * 3
cposible = ctotal - cposible
If cposible > 2 Then
ctotal = ctotal + cposible
Else
ctotal = ctotal - cposible
End If
End If
Next contador
End Sub
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,224,595
Messages
6,179,799
Members
452,943
Latest member
Newbie4296

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