Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
With Range("B1:B100")
Set FoundJurong = .Find(What:="Jurong", LookAt:=xlPart) Set FoundTPY = .Find(What:="Toa", LookAt:=xlPart) If Not FoundJurong Is Nothing Then FoundJurongStart = FoundJurong.Row For x = 1 To 100 Set FoundJurong = .FindNext(FoundJurong) 'jurong FoundJurongEnd = FoundJurong.Row + 1 'jurong Next End If If Not FoundTPY Is Nothing Then FoundTPYStart = FoundTPY.Row For x = 1 To 100 Set FoundTPY = .FindNext(FoundTPY) 'Toa Payoh FoundTPYEnd = FoundTPY.Row + 1 'Toa Payoh Next End If End With Dim r As Variant For r = FoundJurongStart To FoundJurongEnd 'jurong If TextBox1.Value = Sheet6.Cells(r, 1).Value Then Label1.Visible = True End If Next For r = FoundTPYStart To FoundTPYEnd 'TPY If TextBox1.Value = Sheet6.Cells(r, 1).Value Then Label3.Visible = True End If Next End Sub It is a search button that will search the data in under 2 groups: 'Jurong' and 'Toa'.When clicked the search button, it will search the data( keyed in textbox1) in 'sheet6' and then change the visibility of labels.if the data is under 'jurong' group, label 1 will become visible, if data is under 'Toa' group, label3 will become visible. I'm wondering why the code above cannot run properly but if i only search for 1 part( i.e: i delete all the codes regarding 'TPY, and search the data in 'Jurong' group), it will work properly. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Debug this | Excel Programming | |||
How To Use Debug | Excel Programming | |||
help with debug | New Users to Excel | |||
Debug VBA | Excel Programming | |||
* How do we debug this? ... | Excel Programming |