+ Reply to Thread
Results 1 to 6 of 6

Userform Setup

Hybrid View

tome10 Userform Setup 05-07-2023, 12:47 AM
torachan Re: Userform Setup 05-07-2023, 06:04 AM
tome10 Re: Userform Setup 05-09-2023, 01:54 PM
torachan Re: Userform Setup 05-09-2023, 06:29 PM
tome10 Re: Userform Setup 05-10-2023, 05:40 PM
torachan Re: Userform Setup 05-11-2023, 02:05 PM
  1. #1
    Banned User!
    Join Date
    08-10-2011
    Location
    Little Rock Arkansas
    MS-Off Ver
    Office LTSC Professional Plus 2021
    Posts
    101

    Userform Setup

    I'm trying to set up my first ever userform. First off, this form will be shared between all worksheets, I assume whatever worksheet's toggle button/active sheet is where it gets the data in the Notes Field, and files the new data in that worksheet.
    A1 through A11, B1 through B11

    .Userform1.PNG

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Userform Setup

    The whole process starts off with a well thought out tabulated data storage sheet.
    Forget about 'pretty' colours and formatted 'boxes' - the UserForm is your 'View'/'Interface' - not your sheet (that can/should be hidden to prevent manual input).
    I have attached an elementary UserForm that I use to illustrate the basics (simply by expanding the size of the loops you can expand this simple code to incorporated dozens of textboxes etc.,)
    The attached PDF gives a better view of the structure and syntax.
    Attached Files Attached Files
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  3. #3
    Banned User!
    Join Date
    08-10-2011
    Location
    Little Rock Arkansas
    MS-Off Ver
    Office LTSC Professional Plus 2021
    Posts
    101

    Re: Userform Setup

    How do I enter numbers in Textbox1, and Textbox 2 shows the product of this? I borrowed the key down from somewhere else, is this a proper use for it?

    Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    TextBox2.Value = CONCATENATE(Round(Left(TextBox1.Value, 4) * 1.609, 2), "km")
    End Sub

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Userform Setup

    Concatenate is a worksheet function and does not work in VBA - also it is a string join function and has no place in a numeric calculation.
    I have assumed the calc is to two decimal places with a suffix of "km" - you need to also intercept the possibility of non-numeric entry that will cause the code to fail with an error.

    Private Sub TextBox1_Change()
    If IsNumeric(TextBox1.Value) Then
    TextBox2.Value = Format((TextBox1.Value * 1.609), "#0.00 km")
    Else
    TextBox2.Value = ""
    End If
    End Sub

  5. #5
    Banned User!
    Join Date
    08-10-2011
    Location
    Little Rock Arkansas
    MS-Off Ver
    Office LTSC Professional Plus 2021
    Posts
    101

    Re: Userform Setup

    That Worked thanks!

  6. #6
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Userform Setup

    thanks for the feedback and added rep point - glad to have helped.

+ 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] setup an outlook email with multiple recipients using a userform
    By colin7 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-13-2019, 02:43 AM
  2. [SOLVED] how to insert modified page setup in print setup
    By JEAN1972 in forum Excel General
    Replies: 1
    Last Post: 01-11-2019, 06:02 AM
  3. combining chart userform and data transfer userform into 1 userform
    By H_Kennedy in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-04-2014, 07:11 AM
  4. combining chart userform and data transfer userform into 1 userform
    By H_Kennedy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-03-2014, 12:28 PM
  5. [SOLVED] need help with page setup/print Setup on a worksheet
    By laurabach in forum Excel General
    Replies: 9
    Last Post: 04-28-2013, 11:44 PM
  6. [SOLVED] Open a userform from a userform, but preserve the info in the original userform
    By jfoerch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2013, 02:38 PM
  7. Rate Code Setup Userform: How to Prevent overlapping dates
    By CuvelieY in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-17-2010, 08:38 AM

Tags for this Thread

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