+ Reply to Thread
Results 1 to 2 of 2

Save as Macro in excel - Help needed!!

Hybrid View

  1. #1
    Cillian
    Guest

    Save as Macro in excel - Help needed!!

    Hi,

    I have a macro with these lines in it:

    FName = Cells(2, 2).Value
    ActiveWorkbook.SaveAs Filename:=FName

    This works fine and saves the file as the value in the cell - however I want
    to be able to call the file by the value in three cells and also add some
    text, so the file name would look like:

    "Reference (Cells (2,2).Value) Region (Cells (4,2).Value) Day (Cells
    (5,2).value)"

    Can anyone help??????


    --
    Cillian

  2. #2
    Dave Peterson
    Guest

    Re: Save as Macro in excel - Help needed!!

    dim myFileName as string
    with worksheets("Sheet99")
    myfilename = .cells(2,2).value & " Region " & .cells(4,2).value _
    & " Day " & .cells(5,2).value
    end with

    Remember that if any of those cells contain a date, you may have to format the
    value to use it as a file name:

    .... & " Day " & format(.cells(5,2).value,"yyyymmdd")






    Cillian wrote:
    >
    > Hi,
    >
    > I have a macro with these lines in it:
    >
    > FName = Cells(2, 2).Value
    > ActiveWorkbook.SaveAs Filename:=FName
    >
    > This works fine and saves the file as the value in the cell - however I want
    > to be able to call the file by the value in three cells and also add some
    > text, so the file name would look like:
    >
    > "Reference (Cells (2,2).Value) Region (Cells (4,2).Value) Day (Cells
    > (5,2).value)"
    >
    > Can anyone help??????
    >
    > --
    > Cillian


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1