LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Auto Cell Color using VB

I am trying to auto color cells using this VB code.



Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

If Not Intersect(Target, Range("A1:A100")) Is Nothing Then
Select Case Target
Case 1
icolor = 6
Case 2
icolor = 12
Case 3
icolor = 7
Case 4
icolor = 53
Case 5
icolor = 15
Case 6
icolor = 42
Case 7
icolor = 1
Case 8
icolor = 20
Case 9
icolor = 30
Case 10
icolor = 40
Case 11
icolor = 51
Case 12
icolor = 14

Case Else
'Whatever
End Select

Target.Interior.ColorIndex = icolor
End If

End Sub

The problem I am having is I have to either hard code in data to change the
color of the cell or I can only copy data into cells one cell at a time to
change the color. What I would like to do is copy data that is on multiple
rows and past it to the work sheet with the VB code and have all of those
cells auto color to my specified colors. I am getting a Debug error stating
"Run time error '13' Type Mismatch" Any help will be greatly appreciated.




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Fill Color Cell Steve Excel Worksheet Functions 1 July 15th 08 01:18 AM
Auto Cell Color using VB TNfisherman Excel Discussion (Misc queries) 4 June 13th 08 07:56 PM
Auto Fill Color of a particular Cell if conditions are put Akash Excel Programming 8 January 4th 07 12:55 PM
Auto Cell Color Chuckers Excel Discussion (Misc queries) 9 March 30th 06 01:56 AM
Auto Change in Cell Color carl Excel Worksheet Functions 1 March 24th 06 04:28 PM


All times are GMT +1. The time now is 11:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"