Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple Line of Code (Excel VBA)

    I want to paste the file name of an active file into a cell of another file.

    Thanks

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Lounger
    Join Date
    Jan 2004
    Location
    Prague, Czech Republic
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Simple Line of Code (Excel VBA)

    Hello,
    try:
    <pre>Sub PasteName()
    Dim trgSht As Excel.Worksheet
    srcWbkName = ActiveWorkbook.Name
    Set trgSht = Workbooks("Frequency.xls").Sheets(1)
    trgSht.[a1] = srcWbkName
    End Sub</pre>



    My workbook to write to is named Frequency.xls

    HTH

    Martin
    Regards,
    Martin

  4. #3
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Simple Line of Code (Excel VBA)

    Thanks

    ActiveWorkbook.Name

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •