+ Reply to Thread
Results 1 to 2 of 2

How can I find a any text in excel columns that a typed in a Textbox ??

Hybrid View

  1. #1
    Registered User
    Join Date
    01-06-2015
    Location
    Prague
    MS-Off Ver
    MS Office 2007
    Posts
    1

    Lightbulb How can I find a any text in excel columns that a typed in a Textbox ??

    I make a simple UserForm and I want a searching in a excel column any text that I typed in a textbox.
    Code for cmdbutton.
    Any suggestions ??

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,946

    Re: How can I find a any text in excel columns that a typed in a Textbox ??

    Option Explicit
    
    Sub sFindCell()
    
    ' this routine looks for whatever is in cell E4 in column H
    
    Dim rStart As Range: Set rStart = Range("H1")
    Dim rSearch As Range: Set rSearch = Range("E4")
    Dim rFind As Range
    
    ' for testing
    rSearch = "x"
    Range("H6:H14") = _
        Application.WorksheetFunction.Transpose( _
            Array("a", "b", "c", "d", "e", "f", "x", "y", "z"))
    
    On Error Resume Next
    Set rFind = _
        rStart.EntireColumn.Find( _
            What:=rSearch, _
            After:=rStart, _
            LookIn:=xlFormulas, _
            LookAt:=xlWhole, _
            SearchOrder:=xlByRows, _
            SearchDirection:=xlNext, _
            MatchCase:=False, _
            SearchFormat:=False)
            
    MsgBox rFind.Address
    On Error GoTo 0
    
    End Sub

    Change the code to use the ComboBox value.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 06-08-2012, 06:54 PM
  2. Macro InputBox which will find text typed in sheet?
    By aiwnjoo in forum Excel Programming / VBA / Macros
    Replies: 40
    Last Post: 04-20-2010, 08:12 AM
  3. Find Text from textBox then past what is found on sheet1
    By Mark Cover in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-05-2005, 12:05 PM
  4. Excel merged cell - can it automatically expand as text is typed?
    By Joanne (JAS) in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 01-07-2005, 09:06 PM
  5. Excel merged cell - can it automatically expand as text is typed?
    By Joanne (JAS) in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 01-07-2005, 07:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1