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: 19
Default Macro to find an occurrence and create blanks rows

Hello everyone,
I have been helping Wendywith her project, but i am
a novice just as she. I was able to find this macro, but
it is not exactly what she is looking for. it only
changes the first or every total.
We would like it to change every 5th occurrences of total
total1. The 10th total to total2. etc...and after every
occurrence it creates 5 blank rows above the replace
total1. Could someone help us please?
I am embarrassed to ask TOM because he has been of extreme
help through out this project

Sub find()
Dim rFound As Range
Dim szFirst As String


ThisWorkbook.Worksheets(1).Activate
Set rFound = Columns(1).find("total")
Do While Not rFound Is Nothing
''' Store address of first occurrence
If szFirst = "" Then
szFirst = rFound.Address
ElseIf rFound.Address = szFirst Then
Exit Do ''' If we have looped around, quit
End If
rFound.Value = Application.Substitute(rFound.Value,
_
"total", "total1")
Loop

End Sub
 
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
macro to fill in rows with blanks hnyb1 Excel Discussion (Misc queries) 5 September 9th 09 03:26 PM
Find Last Occurrence of Number KimC Excel Discussion (Misc queries) 4 January 12th 09 03:24 AM
How to find SECOND occurrence in a string? Bill_S Excel Worksheet Functions 4 March 19th 07 06:49 PM
Find nth occurrence and replace with ":" marlea Excel Worksheet Functions 4 October 5th 05 10:43 PM
find last occurrence REMnLYN Excel Worksheet Functions 9 March 29th 05 10:43 AM


All times are GMT +1. The time now is 08:59 AM.

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"