interior color of selected cells

onarollcanada

New Member
Joined
Sep 24, 2012
Messages
11
When I select any number of adjacent cells (could be in a row or a column), anywhere on my spreadsheet, I would like to then press a form control button that will fill the interior color with color the 16738047. I have tinkered with several codes I've found online, but so far they only color the first selected cell and not the others.

Any suggestions?

Thanks
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
How about
Code:
Sub onarollcanada()
   Selection.Interior.Color = 16738047
End Sub
 
Upvote 0
How about
Code:
Sub onarollcanada()
   Selection.Interior.Color = 16738047
End Sub
Thanks for your quick reply. I had already tried this code but it only colours the first cell in my selection of several cells. It works on a brand new workbook though. Thanks again for your help.
 
Last edited:
Upvote 0
Do you have any conditional formatting on the sheet it doesn't work on?
 
Upvote 0
I got it working. There was a conflict with another macro I had on the page. Once I deleted it, your code worked perfectly :) Thanks for your help.
 
Upvote 0
Glad you sorted it & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,721
Messages
6,174,098
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