View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Francois via OfficeKB.com Francois via OfficeKB.com is offline
external usenet poster
 
Posts: 109
Default Conditional Formatting through VBA ODBC

JLGWhiz wrote:
Not sure which event would work in your case, but the Worksheet_Change does
not appear to be the correct one. Maybe Worksheet_Activate? Or tag this
macro onto the tail end of your download code.

Can anyone point me in the right direction with this Macro.

[quoted text clipped - 34 lines]
Application.EnableEvents = True
End Sub



I decided to try a different method:-

' Refresh ODBC
Range("D8").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Range("D8").Select



For I = 1 To 100

With ActiveSheet.Cells(I, 4) 'COL 4 = COL D

If .Value = "123" Then
.Interior.ColorIndex = 3

ElseIf .Value = "456" Then
.Interior.ColorIndex = 4

ElseIf .Value = "789" Then
.Interior.ColorIndex = 5

ElseIf .Value = "abc" Then
.Interior.ColorIndex = 6

'etc


End If
End With
Next


I don't suggest it's smart, only that it works.

Thanks for your reply, and to others on my wrongly posted thread

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