Chirag R Raval
Member
Dear Sir,
My macro stop at "Set firstfound = found.Address"-Says "Type Mismatch"
basically its just "Subtotalled Rows Formatting Macro"
is here
Macro always stop at "Set firstfound = found.Address"
I already change variable as "Dim firstfound As Range" to "Ranges", "Variant", and do
all as I can but can't resolve..
actually it will be become Start Point of Loop this "first address" of loop.
& loop end if this address found again ...
Help appreciated.
Regards,
Chirag
My macro stop at "Set firstfound = found.Address"-Says "Type Mismatch"
basically its just "Subtotalled Rows Formatting Macro"
is here
Code:
Sub Loop_Find_And_Format()
Dim myrange As Range
Dim sht As Worksheet
Dim LastRow As Long
Dim LastColumn As Long
Dim StartCell As Range
Set sht = ActiveSheet
Set StartCell = Range("A1")
'Refresh UsedRange
ActiveSheet.UsedRange
'Find Last Row
LastRow = sht.Cells.Find("*", SearchOrder:=xlByRows, searchdirection:=xlPrevious).Row
'Select Range
sht.Range("A1:J" & LastRow).Select
Const gWORD As String = "Total"
Dim found As Range
Dim firstfound As Range
With myrange
Set found = ActiveSheet.Range("myrange").Cells.Find( _
What:=gWORD, _
LookIn:=xlValues, _
lookat:=xlPart, _
MatchCase:=False)
If Not found Is Nothing Then
Set firstfound = found.Address
Do
found.Select
With ActiveCell
myrange("myrange").Rows.Select
End With
With Selection.interiro
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent1
.TintAndShade = 0.799981688894314
.paterntintandshade = 0
End With
Set found = .FindNext(found)
Loop While Not found Is Nothing And found.Address <> firstfound
End If
End With
End Sub
Macro always stop at "Set firstfound = found.Address"
I already change variable as "Dim firstfound As Range" to "Ranges", "Variant", and do
all as I can but can't resolve..
actually it will be become Start Point of Loop this "first address" of loop.
& loop end if this address found again ...
Help appreciated.
Regards,
Chirag