+ Reply to Thread
Results 1 to 6 of 6

Telling the userform which sheet to do what on in code

  1. #1
    Registered User
    Join Date
    01-14-2013
    Location
    Georgia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Telling the userform which sheet to do what on in code

    Attached what I have. I'm working with the userform1 and not userbox but haven't removed that yet as I was using it to store code, yeah I don't know why. I was able to get the search, log and update data working seperately on a seperate workbook but when I plugged in the code I realized that it doesn't know which sheet to do what on and I can't figure out the code to tell it. Pardon if the code (or the whole thing for that matter) looks like a hot mess, I'm new to this and learning as I go and haven't finished with all the data that goes in. I wanted to get the code working first. What this needs to do is as follows -

    It needs to search on the sheet CURRENT and populate the results from there into userform1.

    When the cmdbtns return, out or update are pressed, it needs to update on CURRENT.

    But when return or out are clicked, it also needs to log it on the sheet LOG.

    All of the coding works seperately, but together its not as I'm guessing it doesn't know where to do what.

    How do I tell it to do this on this sheet and that on another in the code? And where do I plug that in at? Thanks for any help! Much appreciated for the VBA education I've received from these forums so far!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Telling the userform which sheet to do what on in code

    Hi,
    i have changed a few items on this part of code for the address search button to work

    Please Login or Register  to view this content.
    this is a major piece of work to sort out and could take hours.
    just a few pointers
    you were searching the wrong range, your object names were wrong (text box & labels etc), and your offsets were wrong - you were using rows below rather than columns to left and right.

    Sorry cant help any more, as i said this is a mjor piece of work, of which i have done many of these before.
    You may want to start of with some more simpler items first.
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  3. #3
    Registered User
    Join Date
    01-14-2013
    Location
    Georgia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Telling the userform which sheet to do what on in code

    LOL I appreciate the help. I'm going to run with what you changed and see if I can get that to answer my questions. I had the search and log functions working while they were in seperate workbooks and copied them over and changed things to fall into the worksheet I uploaded... but looking at it now I do believe I uploaded the wrong file but with what you corrected on that part I may be able to use to correct the right file!

    You answered my question regarding pointing it to another worksheet. Sorry for my mess but it was much appreciated!

  4. #4
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Telling the userform which sheet to do what on in code

    Glad to help.
    Keep going with it, you can use that code for the other 2 search buttons. you just need to change the range to search and also the offset positions.
    just a pointer for updating the information back to the master sheet.
    When you find a match, it would be good to also save the address of the cell on your form - you could use a textbox or label, even make it invisible if you dont want it seen. then when you update the info you can then use the cell address and the offset to transfer the data back. Otherwise you wont know which row/cell to overtype the new data with.

  5. #5
    Registered User
    Join Date
    01-14-2013
    Location
    Georgia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Wink Re: Telling the userform which sheet to do what on in code

    ........*stares blankly at the monitor..... Blinks.....*

    I didn't even think about that! I kept thinking there had to be an easier way but for some reason that didn't even dawn on me! Much appreciated for the suggestion im gonna go figure that out!

  6. #6
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Telling the userform which sheet to do what on in code

    Hi esangsotn
    I have updated your form for you.
    This now populates the form and also updates your current data and adds a new entry to the log sheet for out & return
    Attached Files Attached Files

+ 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