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: 192
Default Find and FindNext

I'm trying to copy all products in a database with common startnames onto a
different sheet. I can successfully copy the first instance, but am having
some trouble copying the next instance. After the program finds the next
instance of the product (if there is one) I don't want to copy the active
cell if there is no other product of that type. The following is what I'm
looking for:

Find product, copy and paste product (that much I have)
Find next product (of same/similar name) copy and past product
If no "next product" is found, go to next i

This is what I have so far:

With Worksheets("wsnew").Range("A60")
rowcount = Range(.Offset(1, 0), .End(xlDown)).Rows.count
End With

For i = 0 To rowcount
Dim printer As Range, FoundCell As String, rowcnt As Integer
Sheets("Data").Select
With ActiveSheet
Range("C8:C6000").Find(What:=curselection.Value).A ctivate
rowcnt = ActiveCell.Row
If ActiveCell.Offset(0, 3).Value Like "Discontinued" Then
If vbNo = MsgBox("Product " & curselection.Value & " has
been _
discontinued." & _
vbLf & "Would you still like to include it in your
analysis?", vbYesNo) Then
j = j - 1
End If
End If
ActiveCell.Copy Sheets("wsnew").Range("A7").Offset(i + j, 0)
End With

Range("C8:C6000").FindNext(After:=ActiveCell).Acti vate

Next i

If what I'm describing doesn't make enough sense, let me know and I can try
to explain further. Any help is greatly appreciated!!!
 
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
Find / FindNext Trouble DJ Excel Programming 2 May 27th 08 10:16 PM
Using 'Find' and 'FindNext' in vba SA3214 Excel Programming 3 March 25th 05 12:17 PM
Find, Findnext VBA Loop SMS - John Howard Excel Programming 5 November 13th 04 03:19 AM
Find...FindNext Problem mtsark Excel Programming 4 August 19th 04 04:09 PM


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