View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Msg Box on each Loop to Replace text

Sub ReplaceTotal()
Dim s as String, cell as Range, rng as Range
Dim i as Long
set rng = range(cells(1,1),cells(rows.count,1).end(xlup))
for each cell in rng
if instr(1,cell,"total",vbTextcompare) then
i = cell.row - 2
do until len(Trim(cells(i,1))) = 0
i = i - 1
loop
cell.Value = cells(i +1,1).Value
end if
next
end sub

--
Regards,
Tom Ogilvy


"Ricky Pang" wrote in message
...
Tom,
Just to clarify, the header and all titles (subtitles) are all within
column A. The data figures are in column B and beyond.

Thanks,
Ricky



*** Sent via Developersdex http://www.developersdex.com ***