View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Sue Sue is offline
external usenet poster
 
Posts: 285
Default Wrong Row Selected

Hi

I eventually Worked it out instead of -2 changed it to -9
--
Many Thanks

Sue


"Sue" wrote:

Hi

I am using the code below to highlight a row in a listbox - however it
always selects a row 8 rows below which it should select. The start row for
Column "C" is row 9 could this be the reason?? have tried all different bits
of code all to no avail can anybody help me.


Private Sub Add602_Click()


Dim rngToSearch As Range
Dim rngFound As Range
Startrownumber = 9
Set rngToSearch = ActiveSheet.Columns("C")
Set rngFound = rngToSearch.Find(What:=Tb1B.Value, _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry " & Tb1B.Value & " was not found."
Else
LisBox1.ListIndex = rngFound.Row - 2
End If
End Sub

--
Many Thanks

Sue