+ Reply to Thread
Results 1 to 8 of 8

Need help modifing userform macro to account for textboxes and combo boxes

  1. #1
    Forum Contributor
    Join Date
    10-03-2015
    Location
    Jamaica
    MS-Off Ver
    2013
    Posts
    120

    Need help modifing userform macro to account for textboxes and combo boxes

    Good day all,

    As the topic states I look like some assistance modifying the attached macro to recognises both TextBoxes and ComboBoxes.

    A colleagues on this forum wrote the attached Macro for me to input volumes of data from a userform into a spread sheet where the data would be stored. The initial user form utilized solely TextBoxes for data input. however since I have utilised ComboBoxes in my user forms as they allow for the option to have dropdowns. but now the macro wont run.

    Please have a look and advise as how i can modify the attached code to account for textboxes as well as ComboBoxes.
    Attached Images Attached Images
    Last edited by Pimp_mentality; 11-10-2015 at 11:57 AM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Need help modifing userform macro to account for textboxes and combo boxes

    You originally had 8 textboxes; TextBox1, TextBox2... TextBox8. Which of those textboxes were replaced by Comboboxes and what are the combobox control names?
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Need help modifing userform macro to account for textboxes and combo boxes

    The first bit is easy enough.

    Please Login or Register  to view this content.
    In regards to the second bit, it depends on how your controls are named. Since you only have 8 controls, you could do

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Forum Contributor
    Join Date
    10-03-2015
    Location
    Jamaica
    MS-Off Ver
    2013
    Posts
    120

    Re: Need help modifing userform macro to account for textboxes and combo boxes

    Quote Originally Posted by AlphaFrog View Post
    You originally had 8 textboxes; TextBox1, TextBox2... TextBox8. Which of those textboxes were replaced by Comboboxes and what are the combobox control names?
    well for this particular Userform textbox 8 was replaced with a ComboBox, however I have several other userforms, utilizing the same coding, which have different textboxes replaced by ComboBoxes (not necessarily in sequential order.

  5. #5
    Forum Contributor
    Join Date
    10-03-2015
    Location
    Jamaica
    MS-Off Ver
    2013
    Posts
    120

    Re: Need help modifing userform macro to account for textboxes and combo boxes

    Quote Originally Posted by mikerickson View Post
    The first bit is easy enough.

    Please Login or Register  to view this content.
    In regards to the second bit, it depends on how your controls are named. Since you only have 8 controls, you could do

    Please Login or Register  to view this content.
    Can I assume that in the first line of code was meant to be If Typename(t) = "TextBox" or Typename(t) = "ComboBox" Then

    vs

    If Typename(t) = "TextBox" or Typename(t) - "ComboBox" Then

    Please take note of the = and - sign before combobox

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Need help modifing userform macro to account for textboxes and combo boxes

    Yes, the idea was to add a second conditional and the AND operator.

  7. #7
    Forum Contributor
    Join Date
    10-03-2015
    Location
    Jamaica
    MS-Off Ver
    2013
    Posts
    120

    Re: Need help modifing userform macro to account for textboxes and combo boxes

    Good day mikerickson

    I tried the attached code to my project but still getting debugging errors. I have attached a stripped down version of the work sheet so you can see what I wanted. the UserForm under scrutiny is titled StuPerInfoFom
    Attached Files Attached Files

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Need help modifing userform macro to account for textboxes and combo boxes

    Please Login or Register  to view this content.

+ 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] Clear all text boxes-combo boxes in a userform.
    By MariaPap in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2014, 11:16 AM
  2. [SOLVED] Help with code for userform text boxes, combo boxes and excel
    By innerise in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-20-2014, 09:07 AM
  3. Main Form Multiple Combo Boxes Control Subform textboxes
    By jvbeats in forum Access Tables & Databases
    Replies: 0
    Last Post: 02-01-2013, 01:36 PM
  4. [SOLVED] Indirect in userform combo boxes
    By bwestfall in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-27-2012, 11:24 AM
  5. UserForm/ RowSource (using combo boxes)
    By Squirrel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-31-2011, 05:23 PM
  6. Two Combo boxes on one UserForm
    By NonSira in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 06-23-2010, 03:06 AM
  7. Combo Boxes in UserForm
    By Chris1201 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-14-2010, 05:11 PM
  8. Userform with 2 combo boxes
    By WhiteKelso in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-30-2007, 11:46 AM

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