+ Reply to Thread
Results 1 to 8 of 8

Merge and Center Code

  1. #1
    Registered User
    Join Date
    08-25-2015
    Location
    LA
    MS-Off Ver
    2007
    Posts
    9

    Merge and Center Code

    Hi,

    I am creating a model that does forecasting and planning for a company. I have a table with all the months in different columns and directly above it says either Actual or forecasting. I have a drop down list and I was hoping to use the drop down list to tell what cells to merge together and color as actuals and which to move together and color as forecasting.

    For example if the drop down list is august then all the cells above January through August (D6:K6) would merge together and display "Actuals" in a dark blue formatting color and September through December cells (L6:O6) would merge together and display "Forecast" in a light blue formatting color. And vice versa if the drop down only displayed February then only January and February (D6:E6) would be merged together and display "Actuals" and March through December (F6:O6) would merge together and display Forecast.

    I attached a picture of the model. Any help would be extremely appreciated.

    Thank you!!
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Merge and Center Code

    I think you uploaded the wrong document. Instead of a sample Excel file we could use to quickly demonstrate an answer, you uploaded a Word doc with a picture.

    You can use MATCH() to determine where on that row the word August appears.
    =MATCH(F3, A5:L5, 0)

    Then you can use Conditional Formatting across A5:L5 to change the color characteristics based on if the column number is less than, equal to, or greater than the Match.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-25-2015
    Location
    LA
    MS-Off Ver
    2007
    Posts
    9

    Re: Merge and Center Code

    Is there a code that I can put down

    If cell E1=x merge E6 and D6 and write "actuals" and if F1=x merge F6 through D6 & write "actuals", if G1=x merge G1 through D6 & write "actuals" and so forth?

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Merge and Center Code

    I could probably rig up a macro with a workbook to use. Got one handy?

    Something that triggers itself when you change the month?

  5. #5
    Registered User
    Join Date
    08-25-2015
    Location
    LA
    MS-Off Ver
    2007
    Posts
    9

    Re: Merge and Center Code

    I attached the example model. Thank you for your help!!
    Attached Files Attached Files

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Merge and Center Code

    Right-click the tab and select VIEW CODE, then paste in this event code that watches for changes to cell F4.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    08-25-2015
    Location
    LA
    MS-Off Ver
    2007
    Posts
    9

    Re: Merge and Center Code

    I cannot thank you enough this is amazing!!

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Merge and Center Code

    As it appears you've reached a conclusion, I've marked this thread SOLVED for you.
    FYI, this is done through the Thread Tools located above the first post in this thread. Thanks.

+ 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. shortcut for Merge and Center
    By annux08 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-16-2015, 06:21 AM
  2. Merge and Center Gridlines
    By sammyhellsyea in forum Excel General
    Replies: 1
    Last Post: 09-19-2012, 03:34 PM
  3. Merge and Center
    By lizardlounge in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-15-2010, 01:56 AM
  4. merge and center
    By GINA in forum Excel General
    Replies: 3
    Last Post: 08-15-2005, 12:05 PM
  5. [SOLVED] Merge & Center
    By Rj in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-01-2005, 04:06 PM
  6. Merge & Center
    By JT in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-18-2005, 03:06 PM
  7. [SOLVED] Merge and Center button
    By JT in forum Excel General
    Replies: 1
    Last Post: 03-18-2005, 02:06 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