Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: macro for save as using concetenation of 2 cells as file nam

  1. #1
    New Member
    Join Date
    May 2002
    Location
    Australia
    Posts
    31
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    G'day Guys & Gals from Australia.
    Can someone help with my subject matter.
    I need to be able to run a macro which will join the contents of 2 cells i.e. A1 (Customer Name) & X1 (Quote number)with a hyphen in the middle and use the result for the filename. I would like the macro to autorun when Both cells have been filled.
    Any thoughts please.
    Cheers Coco

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Cell A1 and X1?
    Or does X stand for a variable column?
    Tom

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    This code does not specify a path but simply saves the active workbook as the name you wanted.


    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$1" Or _
    Target.Address = "$X$1" Then
    If Len(Range("A1")) <> 0 And _
    Len(Range("X1")) <> 0 Then
    ActiveWorkbook.SaveAs _
    Range("A1") & "-" & _
    Range("AX1") & ".xls"
    End If
    End If
    End Sub


    Tom

  4. #4
    New Member
    Join Date
    May 2002
    Location
    Australia
    Posts
    31
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks a million Tom., I think that will get me out of trouble. If not I will certainly be able to adapt it.
    I am going to post a much curlier problem tomorrow, I hope you get to see it, I'll be interested to see if you have any ideas on my next one.
    Thanx again mate -- First time I have ever used a resource like this and you have made my introduction a pleasure.
    Cheers Bob Cohen AKA Coco

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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