+ Reply to Thread
Results 1 to 8 of 8

Using TextBox1 field in userform to name and add new worksheet.

  1. #1
    Registered User
    Join Date
    10-04-2018
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    58

    Using TextBox1 field in userform to name and add new worksheet.

    Hello,

    I am struggling on how to get my code to work. I want it to use a field from a user form to create a new worksheet and rename it whatever is in the field. What I am getting stuck on is how to make the code check if that name is already taken...If it isn't then go ahead and create it, if not, give msgbox.

    HTML Code: 

  2. #2
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Using TextBox1 field in userform to name and add new worksheet.

    Userform module
    Please Login or Register  to view this content.
    Module
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-04-2018
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    58

    Re: Using TextBox1 field in userform to name and add new worksheet.

    Thank you so much!

    I didn't realize I had to separate them out like that!

  4. #4
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Using TextBox1 field in userform to name and add new worksheet.

    Glad to help, thanks for rep and marking as solved

  5. #5
    Registered User
    Join Date
    10-04-2018
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    58

    Re: Using TextBox1 field in userform to name and add new worksheet.

    Sorry but, just a follow up question.... What If I have a table in sheet1 as a template and I want the new sheet above to be created and have the same table in it as sheet1?

    So an example would be, I name the new sheet name in my textbox1 value and click create, the code above works perfectly to create a new tab and name it my textbox1 value... but what I want is that sheet to also have the same layout as my template sheet1... I can only get the code to copy the sheet1 and create a new worksheet, not paste into the one I just created.

    I am using this code in my module after the one above.
    HTML Code: 
    Last edited by cwelsh; 04-18-2019 at 09:36 AM.

  6. #6
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Using TextBox1 field in userform to name and add new worksheet.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-04-2018
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    58

    Re: Using TextBox1 field in userform to name and add new worksheet.

    Thank you but for some reason it makes the table all squished

    Perhaps I need to aut0fit?

  8. #8
    Registered User
    Join Date
    10-04-2018
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    58

    Re: Using TextBox1 field in userform to name and add new worksheet.

    Yes that got it!


    Again, thank you so much.

+ 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. How to minus textbox1.value from textbox2.value userform
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-10-2017, 07:55 AM
  2. [SOLVED] Userform TextBox1.Text in vlookup issue
    By PFDave in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-23-2016, 06:19 AM
  3. [SOLVED] 'Cell value' to 'textbox1.text' in userform
    By Marcin4111 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-22-2015, 06:19 AM
  4. Get Data from a cell into TextBox1 in Userform?
    By excellenthelp in forum Excel General
    Replies: 3
    Last Post: 03-22-2014, 06:42 AM
  5. [SOLVED] Userform Textbox1 = Val(Textbox2.Value) / 2
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-14-2013, 09:37 AM
  6. [SOLVED] Copy Data loaded via Userform to a worksheet named in 1 field of the Userform
    By audax48 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-15-2012, 01:44 PM
  7. [SOLVED] Outlook UserForm Textbox1=Subject
    By NewGuy OnBlock in forum Outlook Programming / VBA / Macros
    Replies: 2
    Last Post: 04-19-2012, 06:47 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