+ Reply to Thread
Results 1 to 3 of 3

using find in code

  1. #1
    Registered User
    Join Date
    07-20-2006
    Posts
    4

    using find in code

    I have a database set up on worksheet "Agents". In this database column A is Agent Name, Coulnm B is id number, column C is commission, etc. The following code will find the name in column A (name only appears once in column A).
    Please Login or Register  to view this content.
    I have two questions:

    1. What code would substitute the name found on sheet "data", Range("G6") for name in the code above?

    2. What code would delete the entire row that the name is found in under column A?

    Thanks for any help

    Max
    Last edited by VBA Noob; 06-07-2007 at 04:04 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388
    1. Set rngFound = .Find(Sheets("data").Range("G6"), lookat:=xlWhole)
    2. rngFound.EntireRow.Delete

    I'd also use an If statement to check if a match is found.

  3. #3
    Registered User
    Join Date
    07-20-2006
    Posts
    4
    Thanks T-J! That did it. I had tried every version of adding additional commas, but it never occurred to me to delete the two commas around name.


    Thanks

+ 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