VBA IF statment

Status
Not open for further replies.

PerunPL

New Member
Joined
Jun 18, 2018
Messages
6
hello,
I 'm really knew to VBA coding, and I was wondering if you guys could help.
So I was wondering if anyone could help me with this code.
I'm trying to make the if statement code for VBA, it can be either sub or function.
ok so I'm trying to make if statement that says; " if active cell background color is RGB (0,176,240), and if cell B2 says "s-1" then copy the number form A2 to C2, if it Says "s-2" copy the number to D and if it says S-3 copy the number do E"
however if the cells are not manually colored than don't copy nothing and just leave it blank. I attached the table on how the results look like. if you guys could help me with this or give me some guidance I would be really thankful.
A
B
C
D
E
#
"s"
S-1
S-2
S-3
5
S-1
5
15
S-3
15
87
S-2
87
150
S-1
78
S-1
78

<tbody>
</tbody>
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Status
Not open for further replies.

Forum statistics

Threads
1,214,641
Messages
6,120,695
Members
448,979
Latest member
DET4492

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