Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear Friends,
I've this code seaching sheets for a specific word and display it. At this time the code accepts only a correct spellings. If wrong a msg box is displayed. I want, that code should accept any two english alphabets typed in the text box and display the result with words that contains two letters Any idea!! Help!! Private Sub cmdbtn1_Click() Dim Sh As Worksheet Dim FoundIt As Boolean Set DestSht = Sheets("Main") NewRow = 12 d = "B4: B5000" 'e = "B1:B5000" Let c = txtbx1.Value For Each Sh In ActiveWorkbook.Worksheets With Sh.Range(d) Set b = .Find(c, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows) If c = "" Then MsgBox "You haven't typed anything in the Search Box" & vbNewLine & "Contact:US", , "Help!!" Exit Sub ElseIf Not b Is Nothing Then firstAddress = b.Address lbl1.Caption = b Do Sh.Range("B" & b.Row & ":H" & b.Row).Copy Destination:=DestSht.Range("B" & NewRow) DestSht.Range("A" & NewRow) = Sh.Name NewRow = NewRow + 1 FoundIt = True Set b = .FindNext(after:=b) Loop While Not b Is Nothing And b.Address < firstAddress End If End With Next If FoundIt = False Then MsgBox "Data not found!!", , "Sorry!!" End If End Sub Private Sub cmdbtn2_Click() lbl1.Caption = "" txtbx1.Value = "" LastRow = Rows.Count Rows("12:" & LastRow).Delete End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro to intsert a word using the "Find" command to search for a word | Excel Programming | |||
word search | Excel Discussion (Misc queries) | |||
search for a specific word and copy the word and the preceeding words until a comma | Excel Programming | |||
need formula to search column for a word and return another word | Excel Discussion (Misc queries) | |||
Search for more than one word | Excel Worksheet Functions |