IF THEN Function and Color Cell

Jones1413

New Member
Joined
Jul 26, 2019
Messages
47
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am having trouble figuring out the code to do the following:

If the data in column A says "Internal" and column B is empty then I want column B to fill with:

cell.Interior.Color = 16776960

If there is data in column B, I don't want it to do anything.

If the data in column A says "Conversion" and column C is empty then I want column C to fill with:

cell.Interior.Color = 16776960

I also want it to loop through the worksheet until the end of the data.

Thanks!
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi & welcome to MrExcel.
How about
Code:
Sub Jones1413()
   Dim Usdrws As Long
   
   With ActiveSheet
      Usdrws = Range("A" & Rows.Count).End(xlUp).Row
      .Range("A1:C" & Usdrws).AutoFilter 1, "Internal"
      .Range("A1:C" & Usdrws).AutoFilter 2, ""
      .AutoFilter.Range.Offset(1).Columns(2).Resize(Usdrws - 1).Interior.Color = 16776960
      .Range("A1:C" & Usdrws).AutoFilter 1, "Conversion"
      .Range("A1:C" & Usdrws).AutoFilter 2
      .Range("A1:C" & Usdrws).AutoFilter 3, ""
      .AutoFilter.Range.Offset(1).Columns(2).Resize(Usdrws - 1).Interior.Color = 16776960
      .AutoFilterMode = False
   End With
End Sub
 
Upvote 0
Hello! Thank you!

If I wanted it to filter multiple things were it says "Conversion". How would I add that in?
 
Upvote 0
Like
Code:
Sub Jones1413()
   Dim Usdrws As Long
   
   With ActiveSheet
      Usdrws = Range("A" & Rows.Count).End(xlUp).Row
      .Range("A1:C" & Usdrws).AutoFilter 1, "Internal"
      .Range("A1:C" & Usdrws).AutoFilter 2, ""
      .AutoFilter.Range.Offset(1).Columns(2).Resize(Usdrws - 1).Interior.Color = 16776960
      .Range("A1:C" & Usdrws).AutoFilter 1, Array("Conversion", "something", "else"), xlFilterValues
      .Range("A1:C" & Usdrws).AutoFilter 2
      .Range("A1:C" & Usdrws).AutoFilter 3, ""
      .AutoFilter.Range.Offset(1).Columns(2).Resize(Usdrws - 1).Interior.Color = 16776960
      .AutoFilterMode = False
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,624
Latest member
gregg777

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