Please help...

  • Thread starter cabana_boy via OfficeKB.com
  • Start date
C

cabana_boy via OfficeKB.com

I hate to even ask this question because it will show my lack of knowledge.
I'm a VB virgin if you will. I've looked all over for an answer, but it's
probably so simple that most people already know the answer without having to
ask.

I've got the below simple macro in an Excel spreadsheet. I originally wanted
the macro just to run in column B (hence the range "B2:B65536"), but due to
some changes I need to have a different set of criteria for cells B2:B157,
B158:B65536, C2:C157, C158:C65536, etc. I think I could easily figure out how
to give it the different criteria for the cell color once I can figure out
how to break out the different ranges.

Please excuse my newbiness...

Private Sub worksheet_change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("b2:b65536")) Is Nothing Then
Select Case Target
Case Is < -705863892.1, Is > -468187826.7
icolor = 38
Case -635277502.88 To -515006609.38
icolor = 35
Case -705863892.1 To -635277502.89
icolor = 36
Case -515006609.37 To -468187826.7
icolor = 36
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top