+ Reply to Thread
Results 1 to 2 of 2

Set height of txtbox in form to auto with fixed width and set other txtbox to same height

  1. #1
    Registered User
    Join Date
    02-18-2014
    Location
    england
    MS-Off Ver
    2019
    Posts
    13

    Set height of txtbox in form to auto with fixed width and set other txtbox to same height

    Excuse the crappy layout! Making pretty isn't worth it till it works!

    I am creating a form which displays sales records. The problem I have is when displaying the quantity, sku, Title, price. Ideally a table would work perfectly, but I can't figure out if this is possible. It does auto populate, but I've left generic info on the pic.

    Crappy pic pointing to the text boxes in question.The title tends to be a few lines long, I need to set the item Title txtbox to be a set width but an auto height. I then need the quantity, sku and price txtboxes to match the height of the quantity txtbox. I'm looking for an invoice style layout.

    At present I'm only working on the first item, I'll need to add the second item after this, hence why I want these to align.

    Current code pinched from the fabulous interwebz:

    Please Login or Register  to view this content.
    Apologies for my naivety. VBA is not something I practise, so while I'm not asking for complete answers, I'd appreciate being pointed in the right direction if anyone can advise, thanks!

    Inkedscreen shot of sales sheet_LI.jpg
    Attached Images Attached Images
    Last edited by scampie; 09-23-2021 at 02:52 AM. Reason: Add code

  2. #2
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Set height of txtbox in form to auto with fixed width and set other txtbox to same hei

    Not the answer to your question.
    But maybe you want to have a look at this code,
    and maybe after you tweak the code it can fit your expactation.

    Please Login or Register  to view this content.
    When the CommandButton1 is clicked,
    it fill the TextBox1 with the active sheet active cell value which has quite many words.

    the TextBox1_Change is fired, it put focus to the TextBox1 and send enter key to fit the height of the TextBox1 to it's value but keep the width.
    Back to CommandButton1 it make the TextBox2 height the same as the height of TextBox1 height.

    With the code above, if the user type in the TextBox1, it will give unpredictable result.
    To solve it, move the SendKeys line to CommandButton1_Click
    Last edited by karmapala; 09-23-2021 at 12:35 AM.

+ 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] Check box if true copy txtbox 1 to txtbox 2
    By mmikem in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2019, 02:27 PM
  2. Replies: 0
    Last Post: 02-13-2016, 03:31 AM
  3. Replies: 3
    Last Post: 03-22-2013, 12:19 AM
  4. Replies: 0
    Last Post: 03-29-2012, 01:05 PM
  5. Macro for fixed column width and row height across multiple sheets
    By westbay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-09-2011, 03:15 AM
  6. auto fit column width and row height
    By kb in forum Excel General
    Replies: 0
    Last Post: 05-22-2006, 03:00 PM
  7. UserForm TextBox with fixed Width and dynamic Height
    By Soniya in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-04-2006, 04:45 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