S
StumpedAgain
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).Activate
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).Activate
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!!!
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).Activate
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).Activate
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!!!