+ Reply to Thread
Results 1 to 16 of 16

Trying to updated sheet based of location returned by Vlookup

  1. #1
    Registered User
    Join Date
    04-26-2013
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Trying to updated sheet based of location returned by Vlookup

    I'm pretty new to this and I have a simple form that allows me to select a record based on the persons last name by means of a Combo Box.

    I then populate a few text boxes in the form using Vlookup - which I would like to have the user change data in one of them and then update the corresponding field in the row. I can update it manually by using the following entry - but the problem is that it's dynamic based on the VLookup.

    Please Login or Register  to view this content.
    Can anyone provide me some insite, I thinik I need to repalce "Range("B1")" with something signifing "current row"


    Below is my code, Thank you very much!

    Mike

    Please Login or Register  to view this content.
    Last edited by mds219; 12-27-2013 at 08:53 PM. Reason: Conform to forum standards of code snippet

  2. #2
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Trying to updated sheet based of location returned by Vlookup

    Hi,

    Can you fix your code as per rule #3

    Thanks.

    http://www.excelforum.com/forum-rule...rum-rules.html

  3. #3
    Registered User
    Join Date
    04-26-2013
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Trying to updated sheet based of location returned by Vlookup

    Thanks for pointing that out Fred... updated it.

  4. #4
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Trying to updated sheet based of location returned by Vlookup

    The best way to achieve what you want is with a search function in VBA rather than lookups.

    Can you attached a dummy file and I will help you build it.

    Thanks

  5. #5
    Registered User
    Join Date
    04-26-2013
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Trying to updated sheet based of location returned by Vlookup

    Here is a short dummy file I put together to show what i'm trying to do. Just need to approve or disapprove the address. I might even switch to a radiobutton but for now need to figure out how to update it.

    Thank you for your help.

    Mike

    Quote Originally Posted by fredlo2010 View Post
    The best way to achieve what you want is with a search function in VBA rather than lookups.

    Can you attached a dummy file and I will help you build it.

    Thanks
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Trying to updated sheet based of location returned by Vlookup

    Mike,

    Look at the file I have attached for you. It does what you are looking for.

    This is the code to under the form1 (with a regular textbox)
    Please Login or Register  to view this content.
    And this is the code under form 2. This one is more efficient and least prone to errors.

    Please Login or Register  to view this content.
    With this code you don't even need a Button to submit your choice. But you can learn about that latter (hint you can click th radiobutons)

    Also notice how I have given meaningful names to the objects (except the labels because we are not manipulating them) its easier to associate txtAddress with an address that it is textbox2

    FormsTest1.xlsm

    Thanks

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Trying to updated sheet based of location returned by Vlookup

    This should do.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    04-26-2013
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Trying to updated sheet based of location returned by Vlookup

    Fred,

    This worked great!

    Can't thank you enough!! I definietly like your approach better than mine.

    Thanks so much!!

    Mike

  9. #9
    Registered User
    Join Date
    04-26-2013
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Trying to updated sheet based of location returned by Vlookup

    Hi Jindon,

    I was able to resolve it with Freds help, both of your approaches look very similar.

    Thank you for assisting, this form saved me so much time!

    Mike

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Trying to updated sheet based of location returned by Vlookup

    Quote Originally Posted by mds219 View Post
    Hi Jindon,

    I was able to resolve it with Freds help, both of your approaches look very similar.

    Thank you for assisting, this form saved me so much time!

    Mike
    No, completely different approach.

  11. #11
    Registered User
    Join Date
    04-26-2013
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Trying to updated sheet based of location returned by Vlookup

    Hi Fred,

    Can you tell me the releveance of the ".Address" at the end of the code snippet below? I changed the header name and is still works so I supsect it might have something to do with formatting.

    Please Login or Register  to view this content.
    Thank you,

    Mike

  12. #12
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Trying to updated sheet based of location returned by Vlookup

    the ending ".Address" will return the address (always absolute) of the range.

    Please Login or Register  to view this content.
    So its just the way i chose to name the variable " GetAddress" and you "GetElement"

    btw if you changed it there you will also have to modify it in the other procedures.

    Thanks

  13. #13
    Registered User
    Join Date
    04-26-2013
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Trying to updated sheet based of location returned by Vlookup

    Thank you Fred, I was able to get it working now. I changed it around a bit, I made the radiobuttons real time and took away the submit button - it was real easy after the example you did for me.

    My final endeavor is to put a scroll bar in place to scroll through the records - which I'm working on at the moment. any advice for the approach? I was thinking of taking the address (of the current cell) and just adding or subtracting for each click

    Again, cannot thank you enough!

    Mike

  14. #14
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Trying to updated sheet based of location returned by Vlookup

    It would be better for this case to instead of using the address "A23" you use the cell denomination of it: Cells(23,1) this will make that addition easier. Cells(row number, column number)


    Thanks

  15. #15
    Registered User
    Join Date
    04-26-2013
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Trying to updated sheet based of location returned by Vlookup

    Thanks Fred,

    How does this look? I am planning to put the following code in my ScrollBar1_keyUp

    Please Login or Register  to view this content.
    And of course (-1,0) for the keyDown click.

    Thanks so much!!!

  16. #16
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Trying to updated sheet based of location returned by Vlookup

    Hi Mike,

    I am not sure if this will help you because you have told me you have changed a few things. This is what I think you want to do.

    Sorry I could not help more. If you still need more help and if the main issue in this thread was solved you can always start a new one.

    This is the code for the bar. The only thing you need the bar to do is to change the index in Combobox the rest is already programmed

    Please Login or Register  to view this content.
    FormsTest1.xlsm

    Thanks
    Last edited by fredlo2010; 01-06-2014 at 01:38 AM. Reason: bug fix

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Name PDF file and Customize E mail Subject Entry Based on updated cell info in excel sheet
    By Noushad Vaidyar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-05-2013, 05:12 AM
  2. Cancel argument in event handler passed to subordinate Sub but updated value not returned
    By 6StringJazzer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2013, 12:56 PM
  3. [SOLVED] Split Sheet based on Location and Re-Merge
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-02-2012, 01:09 PM
  4. Save specific sheet to location based on contents of cell
    By KJL in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2012, 08:08 AM
  5. Rev. Auto Updated when sheet is updated and or entire book
    By frankee_gee in forum Excel General
    Replies: 1
    Last Post: 04-07-2008, 05:05 PM

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