Posts by theath

    I need help with a macro. When I run the macro, I need to set the current workbook as a variable. I want to then call that variable later.
    Here is what I have and it doesn't work. I have two workbooks open. If I name them in the macro I can see it switc focus to each one. If I try to pass in a variable name, I get errors. Any ideas?


    Code
    Sub switchWorkbook() 
    Dim WB As Workbook
    Set WB = ThisWorkbook
    Windows("FEB PROJECT REPORT.CSV").Activate
    Windows(WB).Activate
    End Sub

    Trying to write a script that will sit in one workbook. When initiated it wil prompt the user to select a workbook, copy the data from that workbook and paste it a table in the original workbook. Here is what I have so far, but when I run this I get an error when it gets to the paste function. It won't go back and set the focus on the original workbook. I have highlighted in red where the script errors out. I have tried a number of variations for that line, but can't seem to find one that works. Any ideas?


    Re: Save workbook as name combining text and cell value


    Thanks!

    I just found the answer on a suggested thread on this site! Worked perfectly. Even was able to format the date the way I would like.

    I should have given up and come here two hours ago. Would have saved a few hairs from graying!

    When the excel file is opened I need to have it saved with a combination of text and a date that is contained within a particular cell.

    The date is formatted mm/dd/yyyy. The file cannot be saved with "/" in the name.
    I need to use the date contained in the cell.

    Any ideas how I can do this?