VBA code that shows all 16.7million colours in colour palette

Mkbonnr

New Member
Joined
Oct 20, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
This program is a bit of fun to display all of the available colours in the palette. The program only gets to 65k colours before an error message is generate, but I would like the programme to run until it displays the full palette of 16.7million colours. Any ideas as to how to avoid the error message once 65k colours are reached? Code is posted below :) Best wishes, Richard

Option Explicit



Sub Coloured_cells3()



Dim i As Long

Dim j As Long

Dim k As Long



For i = 1 To 255

For j = 1 To 255

For k = 1 To 255





Cells(i*j, k).Interior.Color = RGB(i, j, k)



Next k

Next j

Next i



End Sub
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi & welcome to MrExcel.
As far as I know you can't. You will exceed the number of cell formats & that is not something that can be overcome.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,054
Messages
6,122,901
Members
449,097
Latest member
dbomb1414

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