Macro to highlight columns with unknow rows

Apple08

Active Member
Joined
Nov 1, 2014
Messages
384
Hi All

I like to create a macro to highlight the columns in the sheet "Data" starting from row 2 to the last row which is unknow. The last row could be based on the value in column A.

I would like to highlight colour RGB as below:

D and E - 155, 194, 230
J and K - 255, 242, 204
L and M - 221, 235, 247

Thanks for any help.
 

Some videos you may like

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,682
Office Version
  1. 365
Platform
  1. Windows
How about
VBA Code:
Sub Apple()
   With Range("A2", Range("A" & Rows.Count).End(xlUp))
      .Offset(, 3).Resize(, 2).Interior.Color = RGB(155, 194, 230)
      .Offset(, 9).Resize(, 2).Interior.Color = RGB(255, 242, 204)
      .Offset(, 11).Resize(, 2).Interior.Color = RGB(221, 235, 247)
   End With
End Sub
 
Solution

Apple08

Active Member
Joined
Nov 1, 2014
Messages
384
How about
VBA Code:
Sub Apple()
   With Range("A2", Range("A" & Rows.Count).End(xlUp))
      .Offset(, 3).Resize(, 2).Interior.Color = RGB(155, 194, 230)
      .Offset(, 9).Resize(, 2).Interior.Color = RGB(255, 242, 204)
      .Offset(, 11).Resize(, 2).Interior.Color = RGB(221, 235, 247)
   End With
End Sub
Brilliant! It works perfectly! Thanks Fluff :)
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,682
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,867
Messages
5,627,354
Members
416,244
Latest member
JBKool

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
Top