VBA Multiplication Problem

Stephen_IV

Well-known Member
Joined
Mar 17, 2003
Messages
1,168
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I want to thank everyone for all the help in the past. I am trying to get this to work but am having a problem this is the problem area If cells(i,2)*cells(i,9). Could someone please straighten me out.

Thanks in advance Stephen.

Sub doesitequal()
Dim i as Long
For i = 1 to 100
If cells(i,2)*cells(i,9)<>cells(i,10) then cells(i,13).interior.colorindex = 3
Next i
End Sub
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Stephen

What's the actual problem?

Does this work?
Code:
Sub doesitequal()
Dim i as Long
For i = 1 to 100
If cells(i,2).Value*cells(i,9).Value<>cells(i,10).Value then cells(i,13).interior.colorindex = 3
Next i
End Sub
By the way could you not just use conditional formatting?
 
Upvote 0
I keep getting a Run time error'13':
Type mismatch
I could use conditional formatting but you cannot count conditional formatting so I need to use code.
 
Upvote 0
Stephen

What do you mean you can't count conditional formatting?

All you need to do is use the condition with a sumif/countif/sumproduct etc formula.

Did you try the code I posted?
 
Upvote 0
Norie,

Thanks for getting back to me. What I meant is to count the actual color not the condition. Even with your code I am still getting a Run time error'13':
Type mismatch
 
Upvote 0
I keep getting a Run time error'13':
Type mismatch
I could use conditional formatting but you cannot count conditional formatting so I need to use code.
The type mismatch is probably because you don't have numbers in some of the cells.

And, I don't see anything in your code that cannot be done with C.F.
 
Upvote 0

Forum statistics

Threads
1,214,902
Messages
6,122,161
Members
449,069
Latest member
msilva74

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