VBA Code for renaming worksheets

  • Hello, I would like to learn how to rename multiple existing worksheets with the name from a range of cells on the first worksheet based on info from a second range of cells.

    For example, I would like to rename multiple existing worksheets with a part number from column B on sheet 1 only if specific information appears in column E of that same line. Can anyone please help?

    I have already been able to rename the sheets with the part numbers in column B but I don't want a sheet for every part, just specific ones based on column E.
    Any help would be appreciated.

    Thank you

  • Re: VBA Code for renaming worksheets

    So basically you want to rename SheetName to be [SheetName & ValueFromColB] when some sort of flag is set in Column E?

    So what is column E being set to in order to prompt the change to be made?

    Then it's just the case of evaluating that value with an if statement which encapsulates the code that is used to rename the sheet, so something like:

    If ValueInColumnE = TheValueThatPromptsTheNameChange then
            'Code To Update Sheet Name In Here
    End If
  • Re: VBA Code for renaming worksheets

    Thank you for your reply. So column E will either be an M or B meaning Make or Buy. I would like each part number from column b that we make in column E to be made into a new sheet with the part number as the name of the existing next sheet. I think I understand what you are saying and will give this a try. Thank you again

Participate now!

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