Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select row where cell equals 1 - Generalist

Status
Not open for further replies.

pendle666

Technical User
Jan 30, 2003
295
GB
Hello

I have a spreadsheet with up to 300 rows and column G's header is "type" and the rows will contain either

1 - Generalist
2 - Specialist
3 - Consultant


What I need to do is select a row where the specific column contains 1 - Generalist. There won't be a set number of rows where this item occurs, so a simple sort by and select X number of rows won't work for me.

Does this make sense? Can anyone help?

thanks

Pendle
 
Why not simply use an Autofilter ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hello

Thanks for replying. At first I thought, of course, Autofilter. However this doesn't quite do everything I want it to.

In the macro I can sort the data by 1 - Generalist, 2 - Specialist, 3 - Consultant but when it comes to deleting the ones I don't want - for example 3-Consultant. I don't know how many rows there might be containing that item, so I can't just select, I have to select all, and then that includes my header row and I want the header row to stay.


regards
Pendle

 
hi,

1) ask the right question. PHV did answer your question with a relevant suggestion.

So why don't you state your question in full, along with all the relevant supporting information, that will fully describe what it is that you need to do, in the context of your greater objectives.



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hey we'll help you, but we need to know exactly what your issue is and not have to guess.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Try this code:
Code:
Sub generalist()
Dim irow as Integer
irow = 1
Do Until IsEmpty(Cells(irows, 7))
    If Cells(irow, 7) <> 1 Then
        Rows(irow).Delete
    Else
        irow = irow + 1
    End If
Loop
End Sub
This assumes that there are no blanks in col G and there's a title or data in row 1. Otherwise, change the Do command to look in another colum (e.g., change the 7 to 1 for Col A) and the irow = 1 to irow = # of first set of data
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top