Thread: Macro Error
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Macro Error

Hi,

Am Tue, 15 Apr 2014 09:47:36 +0100 schrieb Gaura215:

I have written a code, which is working fine till it reaches the
following script. Is their anything wrong I am doing here. I can confirm
that the range I have defined does contain "a". Or is their any easier
or alternate way to do it using VBA. please help.


did you try to run this code in an older version than 2007? Earlier
version can't work with TintAndShade.
Try following code. It works with all versions and is faster than
looping through the range:

Sub Test()
Dim c As Range
Dim FirstAddress As String

Set c = Range("D10:AX67").Find("a", LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
FirstAddress = c.Address
Do
With c.Font
.Name = "Webdings"
.Size = 11
.ColorIndex = xlAutomatic
End With
Set c = Range("D10:AX67").FindNext(c)
Loop While Not c Is Nothing And c.Address < FirstAddress
End If

End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional