Macro to highlight columns with unknow rows

Apple08

Active Member
Joined
Nov 1, 2014
Messages
375
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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,264
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
375
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,264
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,040
Messages
5,622,343
Members
415,894
Latest member
silverhaze

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