ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Please help... (https://www.excelbanter.com/excel-programming/412491-please-help.html)

cabana_boy via OfficeKB.com

Please help...
 
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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200806/1



All times are GMT +1. The time now is 06:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com