Help with row selection.

  • Thread starter Thread starter Drrott1
  • Start date Start date
D

Drrott1

I cannot seem to find a solution to this. I am sure there is one.

I have a data file that I import into excel and I am able to create
input box to have the user insert text to search for what they need.
can get it to return the value of the row it finds the first cas
(There are several). I can also get it to find the last case of i
along with the row but how do I select these rows, and the row
inbetween so I can copy them to another sheet to further filter ou
which information I need?


I hope I was able to explain my problem

Craig Schellenbach
(e-mail address removed)
Aim: Drrott
 
This may not be terribly elegant but it works:

Create a worksheet that you will eventually hide.
Name a cell on this worksheet “CountOfSearch”

At the point in your code immediately after you have selected the rang
you are searching:

1. Name the range using the ApplyNames method
2. Count the number of times the search text appears in the range usin
the following formula:
Range(“CountOfSearch”).value
"=COUNTIF(Range(“SearchRange”),SearchCriteria)"
Counter= Range(“CountOfSearch”).value

where SearchCriteria is the variable generated by your input box
3. Then use a Do Loop to iterate through the selected range for numbe
of iterations = Counter
In each iteration you can copy/paste the row to another workshee
(remember to move the row in the destination sheet down 1 row eac
time!

Hope this help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top