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: 3
Default FindNext problem when using PasteSpecial

Hi All,

I have a problem with FindNext. In brief, I want to search through a
column until I find some text with the word "Total" in. I then want to
copy some data to a new workbook, save that book and then carry on and
search for the next instance of the word "total" and repeat. I can get
the first part to work but then something happens when I want to find
the next instance of "total". Here is part of the code.

' Search through column B for total
With ActiveSheet.Range("B:B")
' Look in part as part of total row
Set FindBA = .Find(What:="Total", LookIn:=xlValues,
LookAt:=xlPart)
If Not FindBA Is Nothing Then
'Call sub routine that copies & pastes to new sheet
'Find next item
Do
Set FindBA = .FindNext(FindBA)
'Call sub routine that copies & pastes to new sheet
Loop While Not FindBA.Value = "Grand Total"
End If
End With

Stepping through the routine, I can see that when I call the first sub
routine, my object FINDBA changes it's value immediately after the
paste command in the sub routine. This means that when it comes back
to my main routine it is no looking for "Total". When I tested this
routine using a message box, it worked OK. It seems to be the Paste
command that causes the problem.

There are around 6000 rows of data in this column and about 70+
instances of the word Total so I do not want to loop through every
single cell which would be my alternative to using FindNext.

Any help would be much appreciated.

Regards

Glyn Baker
 
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
Findnext Noemi Excel Discussion (Misc queries) 1 December 12th 05 11:23 AM
vba pastespecial joao Excel Programming 2 November 14th 03 03:31 PM
PasteSpecial problem Dave Peterson[_3_] Excel Programming 2 November 6th 03 02:45 AM
PasteSpecial problem Jim Rech Excel Programming 0 November 4th 03 04:47 PM
problem with .FindNext Bob Cochran Excel Programming 6 October 11th 03 02:02 PM


All times are GMT +1. The time now is 06:51 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"