+ Reply to Thread
Results 1 to 12 of 12

VBA not working

  1. #1
    Forum Contributor
    Join Date
    10-22-2014
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    222

    VBA not working

    My goal is to have the first page set as a template which would be applied to any additional sheets added to the book.
    So far I tried to set a code to name the Sheet after A5. This is the code I found online. It was working at the start but not now. I could use a bit of assistance. Thanks. Peter

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jeffreybrown; 11-08-2018 at 02:56 PM. Reason: Added code tags!

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA not working

    Please Login or Register  to view this content.
    Could also use this line

    Please Login or Register  to view this content.
    OR


    Please Login or Register  to view this content.
    Last edited by AB33; 11-07-2018 at 03:58 PM.

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: VBA not working

    .
    Rather than the Sheet Level module, here is another project using a regular module :

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    10-22-2014
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    222

    Re: VBA not working

    Logit: The bottom part of the code is for the sheet name to equal "A5" but it doesn't want to work. I saved the file first. Do I need to run something?

    Peter

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA not working

    Did you try my code?

  6. #6
    Forum Contributor
    Join Date
    10-22-2014
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    222

    Re: VBA not working

    Yes, I just hadn't responded on yours yet. Your code works fine. The second response from Logit included a button to add additional sheets with the same layout. The button works but the sheet name "A5" doesn't.
    Sorry to refer to another person's post. Still stuck.

  7. #7
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: VBA not working

    .
    Strange. It works here as written in the sample workbook posted.

    Did I misunderstand your goal ? You have a TEMPLATE sheet. In A5 you enter the name of the sheet to be created by the TEMPLATE macro.
    The sheet is created and the tab has the name that was entered in A5 on the TEMPLATE sheet.

    ???

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: VBA not working

    Administrative Note:
    • We would love to continue to help you with your query, but first, before we can proceed…
    • Please see Forum Rule #1 about proper thread titles and adjust accordingly...
    • Please see Forum Rule #2 about the proper use of code tags...
    Last edited by jeffreybrown; 11-08-2018 at 02:55 PM. Reason: Information was missing
    HTH
    Regards, Jeff

  9. #9
    Forum Contributor
    Join Date
    10-22-2014
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    222

    Re: VBA not working

    Hello Jeffrey. I want to make the adjustments but would you mind providing more clarity as to which part of the rule(s) you are referring to?

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: VBA not working

    Both the code tags in your first post and the thread title.

    Edit: I added the code tags in your first post.

  11. #11
    Forum Contributor
    Join Date
    10-22-2014
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    222

    Re: VBA not working

    I think I know why then. I was entering the sheet name in A5 thinking the template sheet would change. My bad. It works great!! Much appreciated.

  12. #12
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: VBA not working

    .
    You are very welcome.

+ 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. Replies: 1
    Last Post: 08-30-2017, 02:32 AM
  2. Replies: 1
    Last Post: 02-27-2016, 06:28 PM
  3. Replies: 3
    Last Post: 05-14-2015, 07:32 AM
  4. Correct/Working (Index,Match) formula not working between cells
    By barnerd in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 02-11-2014, 01:20 PM
  5. Replies: 4
    Last Post: 09-03-2013, 02:52 AM
  6. Replies: 9
    Last Post: 03-08-2013, 11:50 AM
  7. Replies: 2
    Last Post: 08-17-2012, 08:16 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