Solved

Populate Project name on new worksheets

Posted on 2014-07-24
7
107 Views
Last Modified: 2014-07-24
Folks,
 I have two workbooks where one workbook (""Consolidated") is appended by new tabs from another workbook ("Append").
Once everything is in updated the user enters in a Project Name in cell S2 of the "Consolidated" workbook and selects "Populated Project Name". That's where I have a problem. The "Populate Project Name" is a form control assigned to a macro labeled "ProjectName". This module,"ProjectName, is hard coded in that only tabs with a year ending in 14 for each month works. I'm needing a way to populate each monthly worksheet with the Project Name, which is in T2:V2 (the cells are merged), regardless of the year.
Consolidated.xlsm
Append.xlsm
0
Comment
Question by:Frank Freese
  • 4
  • 3
7 Comments
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
Comment Utility
Change your ProjectName macro to this and the user only has to click the button (no manual entry in S2:S4) so you can remove the instructions in V2.

Sub ProjectName()

    Dim strName As String
    Dim sht As Worksheet
    
    strName = InputBox("Please enter the project name")
    
    For Each sht In Worksheets
        If sht.Name = "Consolidated" Then
            sht.Range("S2").Value = strName
        Else
            sht.Range("T2") = strName
        End If
    Next
    
End Sub

Open in new window

0
 

Author Comment

by:Frank Freese
Comment Utility
Perfect
Thanks
0
 

Author Closing Comment

by:Frank Freese
Comment Utility
Again, you nailed it!
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
YW. As you've seen, recording macros is often a very unsatisfactory way of adding code.
0
 

Author Comment

by:Frank Freese
Comment Utility
Agreed. It does help some in how things need to be written, just as long as you haven't restricted yourself like I have. I use them sometime to jump start myself.
I'm pulling away from ActiveX controls going forward as much as possible with form controls.
Finally, they have approved the workbooks so I'm sending out the finals now with all the little corrections and additions.
Thank you so very much for all your help here.
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
I'm happy that you're done with this but I'm surprised that they don't want some things protected or some things hidden like people's hourly rates.
0
 

Author Comment

by:Frank Freese
Comment Utility
They've decided to do that themselves, protecting the worksheets. They've been put on notice that cells with formulas had better be protected.
Regarding the rates. On the last "Consolidated" they took those off.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now