View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Coverting worksheet macro to regular macro

Hi,

Try in your Standard Code Module

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Option Explicit
Sub TEST()

Dim myColorIndex As Long
Dim myCell As Range
Dim myRng As Range
Dim i As Long
Dim REF As String
Dim X As Variant
Dim N As Variant

X = Array("b", "v")
N = Array(3, 5)

Application.ScreenUpdating = False
Set myRng = ActiveSheet.Range("o5:Iv2232")
myRng.Interior.ColorIndex = myColorIndex

For i = LBound(X) To UBound(X)

Set myCell = myRng.Find(X(i), LookIn:=xlValues)
If myCell Is Nothing Then GoTo e:

REF = myCell.Address
Do
myCell.Interior.ColorIndex = N(i)
Set myCell = myRng.FindNext(myCell)
Loop While Not myCell Is Nothing And myCell.Address < REF
Next

e:
Application.ScreenUpdating = True

End Sub
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



--
Regards,
Soo Cheon Jheong
_ _
^вп^
--