View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Sub to list colorindexes and the corresponding fill colours

Thanks, Mangesh

Despite several tries at running your sub, I kept hitting a run-time error
1004
"Unable to set the colorindex property of the interior class"

Clicking debug highlighted this line:
rng.Offset(i, 1).Interior.ColorIndex = i

What can I do ?
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"mangesh_yadav"
wrote in message
news:mangesh_yadav.1py5ae_1117627508.3751@excelfor um-nospam.com...

Private Sub CommandButton1_Click()
Set rng = Range("A1")
For i = 0 To 50
rng.Offset(i, 0) = i
rng.Offset(i, 1).Interior.ColorIndex = i
Next i
End Sub