+ Reply to Thread
Results 1 to 4 of 4

Combine a Variable and Constant Sheet Name in VBA

  1. #1
    Registered User
    Join Date
    01-15-2020
    Location
    Livermore
    MS-Off Ver
    Excel 2013
    Posts
    2

    Question Combine a Variable and Constant Sheet Name in VBA

    Hello,

    I am using a macro to take a master sheet and break it out into sub sheets based on a parameter entered by the user. The code is then renaming the new sheets based on this parameter. I'd like to rename the sheet based on the variable parameter plus a constant value. For example:

    If the data is:
    Apple
    Orange
    Banana

    I'd the sheets to be named Apple.Fruit, Orange.Fruit, Banana.Fruit.

    Thank you for your help!
    Please Login or Register  to view this content.
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Last edited by 6StringJazzer; 01-15-2020 at 10:16 PM.

  2. #2
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    Re: Combine a Variable and Constant Sheet Name in VBA

    I take it that ColHeadCell is a named range with the text you want to add? If so it's simple edit.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-15-2020
    Location
    Livermore
    MS-Off Ver
    Excel 2013
    Posts
    2

    Re: Combine a Variable and Constant Sheet Name in VBA

    Hello! I'm sorry, I thought I responded. Unfortunately this is now creating the new sheet with the name but instead of adding all the lines that should go on the tab it only adds one line and then errors out. I will attach a sample file.

  4. #4
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    Re: Combine a Variable and Constant Sheet Name in VBA

    Did you have that sample file?

+ 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] Combine Pivot Table field name with a variable and a constant
    By phoebeyanan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2017, 11:15 AM
  2. [SOLVED] Two formulas - combine them and have constant password?
    By jokris in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-28-2016, 12:40 PM
  3. Call a constant/variable by creating another variable
    By pienaaj in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-12-2013, 10:36 AM
  4. Sum of constant + variable = constant
    By neurogirl900 in forum Excel General
    Replies: 3
    Last Post: 12-19-2011, 11:02 PM
  5. Combine cells but one variable remain constant
    By balexander26 in forum Excel General
    Replies: 3
    Last Post: 11-10-2011, 03:23 AM
  6. Combine a range with a constant number
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-19-2006, 10:25 AM
  7. How to average one constant # to variable #s? A1:A2 A1:A3 A1:A4
    By Colfax in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-01-2006, 10:55 PM

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