Find the next one

D

Duncan

Hi All,

The following is code I have been provided with before and I
manipulate it to use it for many differant projects, I think most of
the credit should go to Tom Ogilvy.

Anyway, this time I am trying to manipulate it to use for a button
that marks a cell as "Technician not Available", so that i can go on
to find the next available technician.

Now the trouble is that the technician names are repeated over and
over, running down column A, at the moment it works perfectly but when
the name is duplicated it doesnt go any further, I want it so that if
there is already something in B column next to the technician it has
found I want it to go the next occurance down with empty B column and
put "Technician not Available" there.

I hope that makes sense, any help would be much appreciated, I have
pasted the code thus far so you can see what I am working with, I am
sure it is an easy task to do this find next procedure but I really
dont have an idea where to start and searching the groups hasnt
provided an answer bespoke enough for my small mind to manipulate!


Private Sub NotUser_Click()
With Sheets(Team.Value).Range("A1:A64000")
Dim oCell As Range
Dim wks As Worksheet
Dim strAddress As String
Dim FindWhat As String
Dim hawb As String
Sheets(Team.Value).Select
hawb = Individual.Value
FindWhat = hawb
If FindWhat <= "" Then
Exit Sub
Else
With Sheets(Team.Value).Range("A1:A64000")
Set oCell = .Find(What:=FindWhat, LookIn:=xlFormulas,
_
Lookat:=xlPart, SearchOrder:=xlByRows,
_
SearchDirection:=xlNext, _
MatchCase:=False)
If oCell Is Nothing Then
MsgBox "Error:-NotFound" & vbCrLf & vbCrLf &
"Maybe Technician not part of this Team?"
Exit Sub
Else
strAddress = oCell.Address(External:=True)
hawb2 = oCell.Offset(0, 1).Address
Range(hawb2).Value = "Technician not Available"
End If
End With
End If
End With
Call Team_Change
End Sub

Many thanks in advance, Any help at all would be most appreciated.

Duncan
 

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

Top