+ Reply to Thread
Results 1 to 9 of 9

Userform data- perhaps like find/replace?

  1. #1
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Userform data- perhaps like find/replace?

    I have a user form with several entry fields...employee name, shift worked, supervisor they report to etc.

    I have a workbook sheet containing 2 groupings of columns.One grouping has 4 columns and then 2 blank columns and another grouping had 3 columns. Each grouping relates to a departmental group.

    I want to be able to use the user form and alter (i.e. replace) pre-existing data on the worksheet or to add an new employee to one of the column groupings based on entries to that userform.

    Is there a website or some basic examples of how to locate data and change it ...if someone can point me in the right direction that I can play around with. I tried googling several keywords but just kept finding how to set-up userforms. Thanks in advance once again... as a complete beginner to vba everyone has been so helpful!

    Something like

    ....find employee x on the worksheet that equals the employee name entered in text box y from user form and change value of cell that is two cells to the right of that cell to the value that is from text box 1 on user form.

    ...or find next blank cell in column x and add data from user form box z (i.e. new employee name) to blank cell and add add from user box 2 to one cell to right of that etc.
    Last edited by LiLi1; 06-22-2010 at 11:12 AM.

  2. #2
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Using user form data- perhaps like find/replace?

    I changed the worksheet to remove the department groupings and just stacked them on top of each other to ease searching and to standardize the data.
    I found something sort of similiar on google about using user forms for what I am trying to and tried to tweek it to my situation. Here's what I am playing with so far. I get a compile error on this line: Set ws = Worksheet("Individuals on Report")


    Please Login or Register  to view this content.

  3. #3
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Using user form data- perhaps like find/replace?

    It's worksheets not worksheet even if there's just one you're referring to.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  4. #4
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Using user form data- perhaps like find/replace?

    Thanks Dom...I fixed the wording to state worksheets. That removes the compile error.

    The code now stops here on this line:

    Set c = Find.IndividualNameEntry.Value

    The error I receive is Object required (Error 424).

    Thanks

  5. #5
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Using user form data- perhaps like find/replace?

    Hi,

    I've popped together a basic working example of what I think you might be getting at.

    Hope it helps,

    Dom
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Using user form data- perhaps like find/replace?

    Exactly what I was looking for! Vastly appreciated! The message box I tried to add didn't work but I can play with that.
    When it comes to this part of the code: ' if no match is found add the name and value to the bottom of the list.
    Is there a way I can add a user prompt asking them if they would like to add the individaul to the report or cancel the running of the program? Is anything like that possible?

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Using user form data- perhaps like find/replace?

    I fixed the message box the ending of the code now looks like this.

    Please Login or Register  to view this content.

  8. #8
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Using user form data- perhaps like find/replace?

    Not a problem, glad it helped.

    This is how you can prompt whether to add the new name or not:

    Please Login or Register  to view this content.

    Dom

  9. #9
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Userform data- perhaps like find/replace?

    Prompt worked perfectly and I added the code for all of the changes (supervisor, shift etc.) now on the user form. The entire form works exactly correctly and I am sure will be a welcome received form by the person who runs this montly report so they no longer need to manually update the worksheet for several hours at the end of each month.

    Once again thanks for the help!

+ 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