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. [TABLE="width: 500"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[/TR]
[TR]
[TD]#
[/TD]
[TD]"s"
[/TD]
[TD]S-1
[/TD]
[TD]S-2
[/TD]
[TD]S-3
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]S-1
[/TD]
[TD]5
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]15
[/TD]
[TD]S-3
[/TD]
[TD][/TD]
[TD][/TD]
[TD]15
[/TD]
[/TR]
[TR]
[TD]87
[/TD]
[TD]S-2
[/TD]
[TD][/TD]
[TD]87
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]150
[/TD]
[TD]S-1
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]78
[/TD]
[TD]S-1
[/TD]
[TD]78
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Status
Not open for further replies.

Forum statistics

Threads
1,223,710
Messages
6,174,019
Members
452,542
Latest member
Bricklin

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