+ Reply to Thread
Results 1 to 7 of 7

Command VBA UserForm

  1. #1
    Registered User
    Join Date
    06-10-2013
    Location
    Englewood NJ
    MS-Off Ver
    Excel 2010
    Posts
    33

    Command VBA UserForm

    I have a user form with three things:
    Two combo boxes and a command Box

    The first combo box just uses a range of different products from the ws.
    The second combobox are numbers 0-100 in increments of 5. (values I want to assign)

    Lastly my command box is what I want this user form to do, which is:

    Find value in first combo box match with string in ws, take number in second command box and offset by 28 columns, and input number in that column. Close userform when finished.

    Heres my poor coding so far:


    Please Login or Register  to view this content.

    Thanks in advance!!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Command VBA UserForm

    At first glance the code looks fine apart from the looping which isn't needed as you know the names of the controls involved.

    Actually I've just noted something else, you are using the value in ComboBox1 for the offset.

    Shouldn't you be using the value 20 in the code if you want to offset that no of columns.

    Also you seem to be putting a value from the worksheet in TextBox2.

    What happened to the second combobox?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    06-10-2013
    Location
    Englewood NJ
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Command VBA UserForm

    Please Login or Register  to view this content.
    I actually switched it to this, hoping to condense it. Still not updating cells nor exiting userform. :/

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Command VBA UserForm

    Are the values in column A of the worksheet numeric?

    If they are then you need to convert the text value of the selected item in the combobox.

    You can do that with CLng or Val.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-10-2013
    Location
    Englewood NJ
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Command VBA UserForm

    the first combo box is based off text in a range, the second combo box is based off
    Please Login or Register  to view this content.
    I'm trying to get the command button to take combobox 1 find in range A:A, offset 28 columns and add value from second combox into 28th column, and exit user form

    Please Login or Register  to view this content.
    Unfortunately its not updating in workbook nor is it exiting out of userform. I don't get any error messages. I'm at a loss.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Command VBA UserForm

    The values in the combobox are text, not numbers.

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

  7. #7
    Registered User
    Join Date
    06-10-2013
    Location
    Englewood NJ
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Command VBA UserForm

    I was creating a mock up for you and it ended up working so I just reqrote the vba in my file and now it works :/ I guess I should be happy and would be if I hadn't spent 4 hours trying to edit this code into oblivion. Thanks anyways!!!

+ 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. [SOLVED] Command Button on Userform appear sunken?
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2013, 07:13 PM
  2. [SOLVED] REfocus on userform after print command within the userform
    By chrisjames25 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-24-2013, 02:29 PM
  3. UserForm Command button
    By aCmE in forum Word Programming / VBA / Macros
    Replies: 7
    Last Post: 01-10-2011, 11:53 AM
  4. Userform Command Button to open new userform
    By JamesT1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2010, 12:02 PM
  5. [SOLVED] need to minimize userform via command button on itself
    By Jed in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2006, 04:45 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