Results 1 to 11 of 11

How to search a column with keywords and write decimal value in to a row

Threaded View

  1. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: How to search a column with keywords and write decimal value in to a row

    Here is a way using A filter Macro
    Sub Button1_Click()
        Dim r As Range, s As String
    
        Set r = Range("B2", Range("B65536").End(xlUp))
    
        r.Offset(0, 1).ClearContents
    
        s = InputBox("What to find?")
    
        With Range("B1")
            .AutoFilter Field:=1, Criteria1:="*" & s & "*"
            
            On Error Resume Next
            
            Set Rng = r.Cells.SpecialCells(xlCellTypeVisible) 'if no items found
            
            If Rng Is Nothing Then
                MsgBox "No records found"
                .AutoFilter
                Exit Sub
            End If
            
            r.Offset(0, 1) = 1.01
            .AutoFilter
        End With
    
    
    End Sub
    Check out the Example
    Attached Files Attached Files
    Last edited by davesexcel; 07-05-2010 at 11:21 PM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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