Solved

Add the file name and date

Posted on 2011-02-28
2
302 Views
Last Modified: 2012-06-27
Looking to add the file name to cell B2, from the list that was selected; and, the date and time on cell C3.  And also, when the data gets copied over, to copy "only" values and formats.

Thanks,
JP


Continuation from:  http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_26853498.html#a35001118   Select-from-open-workbooks.xls
0
Comment
Question by:easycapital
2 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 500 total points
ID: 35001696
Hi JP,

Here is an update for your userform code

Private Sub btnOK_Click()
On Error Resume Next

With ActiveSheet
    .Range("B5:D34").ClearContents
    Workbooks(Me.cbWbks.Value).Sheets("YTD").Range("A1:C30").Copy
    .Range("B5:D34").PasteSpecial Paste:=xlPasteValues
    .Range("B5:D34").PasteSpecial Paste:=xlPasteFormats
    
    .[b2] = Me.cbWbks.Value
    .[c3] = Now
End With

If Err <> 0 Then MsgBox "Sheet YTD not found in workbook " & Me.cbWbks.Value

Unload Me
End Sub


Private Sub UserForm_Initialize()
Dim wbk As Workbook

For Each wbk In Application.Workbooks
    Debug.Print wbk.Name & "{" & wbk.IsAddin
    If wbk.IsAddin = False Then Me.cbWbks.AddItem (wbk.Name)
Next

End Sub

Open in new window


FYI, if you use the ask a related question button, all experts previously involved in the question get notified automatically.

Thomas
0
 

Author Closing Comment

by:easycapital
ID: 35001906
Great!

Thanks for the info.
JP
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows 7 Share with concurrent edits(Excel) 3 31
Vb.net dynamic formulas in runtime 11 61
Formula 6 45
Add a range in an Excel graph 5 27
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
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 a scrolling table in Microsoft Excel using the INDEX function.

914 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

17 Experts available now in Live!

Get 1:1 Help Now