+ Reply to Thread
Results 1 to 6 of 6

Find a row and a specific cell in that row

  1. #1
    Registered User
    Join Date
    05-20-2005
    Location
    North Texas
    MS-Off Ver
    2007
    Posts
    9

    Find a row and a specific cell in that row

    Hello,

    I have a database in a worksheet with several columns (with headers). From a VBA input sheet, I would like to be able to search a database using the Last Name column - say column B - as my key search, locate the row the Last Name is on, and go to a specific cell on that row - say in column P - and edit the data in that cell. I'm sure this is child's play for some of you but I have not had any luck so far with the right code.

    Any help in this regard would be greatly appreciated.

    Thanks in advance,

    Glenn P

  2. #2
    tina
    Guest

    RE: Find a row and a specific cell in that row

    Hi
    if you mean find the last name inputed in column b you could try something
    like
    Sub Macro1()
    Range("B65536").End(xlUp).Offset(0, 14) .select
    End Sub

    "Glenn P" wrote:

    >
    > Hello,
    >
    > I have a database in a worksheet with several columns (with headers).
    > From a VBA input sheet, I would like to be able to search a database
    > using the Last Name column - say column B - as my key search, locate
    > the row the Last Name is on, and go to a specific cell on that row -
    > say in column P - and edit the data in that cell. I'm sure this is
    > child's play for some of you but I have not had any luck so far with
    > the right code.
    >
    > Any help in this regard would be greatly appreciated.
    >
    > Thanks in advance,
    >
    > Glenn P
    >
    >
    > --
    > Glenn P
    > ------------------------------------------------------------------------
    > Glenn P's Profile: http://www.excelforum.com/member.php...o&userid=23595
    > View this thread: http://www.excelforum.com/showthread...hreadid=377601
    >
    >


  3. #3
    Registered User
    Join Date
    05-20-2005
    Location
    North Texas
    MS-Off Ver
    2007
    Posts
    9
    Thanks Tina,

    Here is what I have now.

    Private Sub TextBox12_Enter()

    Set rng = Sheets("Members").Range("D3:Y3999")
    TextBox12.Value = WorksheetFunction.VLookup(ComboBox7.Value, rng, 11, 0)

    ComboBox7 is the Members list of names from which I select a specific name. That is what the VLookup will key from and return the value from the cell in Column N in that specific row, which is returned in TextBox12. The code works fine through this point.

    What I would like to do now is be able to edit that data from the Column N cell (which is in TextBox12 )and return it to that same cell (with the new updated info). This is where I bog down. How do I identify the specifc cell address so I can accomplish this task?

    Thanks so much for your help.

    Glenn

  4. #4
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    TextBox12.Value = WorksheetFunction.VLookup(ComboBox7.Value, rng, 11, 0)
    myRow = WorksheetFunction.Match(ComboBox7.Value, Range("D3:D3999"), 0)+2
    Worksheets("Members").Cells(myRow, 11) = TextBox12.Value


    since you start from row 3, you add 2 in the second line.


    Mangesh

  5. #5
    Registered User
    Join Date
    05-20-2005
    Location
    North Texas
    MS-Off Ver
    2007
    Posts
    9

    Smile

    Mangesh,

    Thanks for the assistance. I understand the code and it works to perfection. Youdaman!

    Glenn

  6. #6
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Glad it worked as you wanted. Thanks for the feedback.

    Mangesh

+ 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