View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.newusers
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default help with vba script

Not too hard to figure out.

Sub coloror()
For Each cell In range("a2:a22")
Select Case cell.Value
Case Is = 90:colchoice = 4
Case Is = 80:colchoice = 6
Case Is = 70:colchoice = 40
Case Is = 60:colchoice = 3
Case Is < 60:colchoice = 2
End Select
cell.Interior.ColorIndex = colchoice
Next
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"lariveesl" wrote in message
...
I guess I should have included the whole script. Just where should I put
what you suggested? And what should I leave out when I replace it??

Thanks again.

Sub coloror()
Dim myrar As Range
Dim colchoice As Integer
Set myrar = Application.InputBox("What range", rangetocheck, , , , , , 8)
For Each cell In myrar
Select Case cell.Value
Case Is = 90
colchoice = 4
Case Is = 80
colchoice = 6
Case Is = 70
colchoice = 40
Case Is = 60
colchoice = 3
Case Is < 60
colchoice = 2
End Select
cell.Interior.ColorIndex = colchoice
Next
End Sub





"Don Guillett" wrote in message
...

For Each cell In range("a2:a22")
cell.interior.ColorIndex=6
next cell

or simply
range("a2:a22").interior.ColorIndex=6


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"lariveesl" wrote in message
...
Here is PART of a script someone did for me

Sub coloror()
Dim myrar As Range
Dim colchoice As Integer
Set myrar = Application.InputBox("What range", rangetocheck, , , , , ,
8)
For Each cell In myrar

When I run the script, and it does work well, I am prompted to put in
the RANGE for the script to look at before it proceeds. I would like to
enter a fixed area, such as A4:D12. How would I rewrite the ("What
range", rangetocheck, , , , , , 8) section to insert this fixed range?

Thanks