Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Add the file name and date

Posted on 2011-02-28
2
Medium Priority
?
324 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

660 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