LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Find and Format code doesn't work

I want to format the "total columns.
I would like this code to look for the rows that has "total.
When found is true format columns "f:m"

Logic: For each row that has the word "total" then format columns f:m
When I used this code to delete rows it worked perfectly, so there must be
something wrong with these lines:

with rng(i, "f:m")
.font.bold = true
.Borders (xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.Rows.ColorIndex = xlAutomatic
end with

Dim myArr As Variant
Dim Rng As Range
Dim I As Long

Application.ScreenUpdating = False
myArr = Array("total")

For I = LBound(myArr) To UBound(myArr)

Do
Set Rng = Range("c:c").Find(What:=myArr(I), _
After:=Range("c" & Rows.Count), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

If Not Rng Is Nothing Then
with rng(i, "f:m")
.font.bold = true
.Borders (xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.Rows.ColorIndex = xlAutomatic
end with
'Rng.EntireRow.Delete
Loop While Not (Rng Is Nothing)

Next I
Application.ScreenUpdating = True

Thanks
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Number Format Code won't work tbmarlie Excel Discussion (Misc queries) 2 October 15th 07 06:46 PM
FIND method doesn't work in UDF. What's wrong with this code? [email protected] Excel Programming 10 July 9th 05 05:32 PM
Keep format after paste from other worksheets - conditional format or EnableControl solution doesn't work No Name Excel Programming 0 May 3rd 04 12:22 PM
Cant get my code work. Find file or create it Poseilus Excel Programming 1 October 12th 03 03:42 PM


All times are GMT +1. The time now is 08:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"