+ Reply to Thread
Results 1 to 2 of 2

checking in vba if item is found within a range

  1. #1
    djb
    Guest

    checking in vba if item is found within a range

    I have used the following code in the past but it no longer works in the
    newer versions of Excel. Is there another way to check if an item is found or
    not within a range.

    Evern though it shows c equal to Nothing in watch mode, the code used below
    gives an error.

    Sub testFindDate()
    With Range("K4:K45")
    Set c = .Find("7/1/2006")
    End With
    If c.Value = "Nothing" Then
    MsgBox "not found"
    Else
    MsgBox c.Address
    End If
    --
    djb

  2. #2
    Jim Cone
    Guest

    Re: checking in vba if item is found within a range

    Sub testFindDate()
    Dim c As Excel.Range
    Set c = Range("K4:K45").Find("7/1/2006")
    If c Is Nothing Then
    MsgBox "not found"
    Else
    MsgBox c.Address
    End If
    End Sub
    --
    Jim Cone
    San Francisco, USA
    http://www.realezsites.com/bus/primitivesoftware


    "djb"
    <[email protected]>
    wrote in message
    I have used the following code in the past but it no longer works in the
    newer versions of Excel. Is there another way to check if an item is found or
    not within a range.
    Evern though it shows c equal to Nothing in watch mode, the code used below
    gives an error.

    Sub testFindDate()
    With Range("K4:K45")
    Set c = .Find("7/1/2006")
    End With
    If c.Value = "Nothing" Then
    MsgBox "not found"
    Else
    MsgBox c.Address
    End If
    --
    djb

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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