Consulting

Results 1 to 3 of 3

Thread: Solved: Save Data Based on Vlookup

  1. #1

    Solved: Save Data Based on Vlookup

    Hey guys

    A quick question, basically I'm using several vlookups to populate text boxes on my form with data, however once the user has editted that data, I want the values within the text boxes to save to the cell within the worksheet that they were first retrieved from.

    For example

    [vba]Me.txtname.Text = Application.VLookup(storeId, Worksheets("Customers").Range("CustomerRecords"), 2, 0)[/vba]
    Then when I click the save button, I want the value within the text box to be saved within the original cell. I gave this a try, obviously it didn't work.

    [vba]Private Sub btnsave_Click()
    Application.VLookup(storeId, Worksheets("Customers").Range("CustomerRecords"), 2, 0) = Me.txtname.Text
    End Sub[/vba]
    Help appreciated.

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Is it one cell on customers worksheet?

    can you post an example?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    EDIT:

    Woot figured out a solution

    [VBA]For Each searchCell In myRange
    If searchCell = storeId Then
    cellLocation = searchCell.Address
    MsgBox "cell is " & cellLocation
    End If
    Next searchCell[/VBA]
    Last edited by Bopo2; 11-02-2009 at 07:15 AM.

Posting Permissions

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