Save workbook with name cells text

  • Hello,


    I want to save an excel workbook with the text of 3 cells in the name.
    Cells C6, B9 and C9 are the cells who contains the info.
    So I want to save the workbook like:

    Code
    NewName = Sheets("Appreciation").Range("C6 & B9 & C9").Text


    But the range is not recognized.
    What is the right code?


    Thanks in advance
    aisietie

  • Re: Save workbook with name cells text


    Hi aisietie,


    Although it's not the answer to your question, you would refer to a range of non-contiguous cells with

    Code
    Set rng = Range("C6,B9,C9")


    but you can't use that with the .Text (or .Value) property.


    The simplest way of coding the concatenation of those three cells is

    Code
    With Worksheets("Appreciation")
        NewName = .[C6] & .[B9] & .[C9]
        '
        ' Or alternatively
        '
        NewName = .Range("C6").Value & .Range("B9").Value & .Range("C9").Value
        '
    End With

    [COLOR="Purple"]Regards,[/COLOR]
    [COLOR="Purple"]Batman.[/COLOR]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!