View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
wbrowse wbrowse is offline
external usenet poster
 
Posts: 6
Default early beginner not satisfied with simple macro

Hi,
Although this macro works, is there a way to improve it ?

===start===

Option Explicit

Sub FormatHighestValue()
Dim c as Rang
Dim iEndRow as Integer
Dim iEndCol as String
iEndCol = ThisWorkbook.Sheets(1).Range("B2").End(xlToRight). Address
iEndRow = ThisWorbook.Sheets(1).Range("B2").End(xlDown).Row
iEndCol = Left(iEndCol, 2)
iEndCol = Right (iEndCol, 1)
ThisWorkbook.Range("B2" & ":" & iEndCol & iEndRow).Select
For Each c in Selection.Cells
If c.Value 1000 Then
c.Font.ColorIndex = 3
End If
next c
End Sub

===end===

I think code about iEndCol could be reduced...

Thanks in advance for your help.

Ppp