Rob
Rob

Reputation: 1

Excel VBA - combining worksheets from multiple workbooks and rename new worksheet tab

I am trying to create some VBA code that will do the following:

  1. Take worksheets 2 and 3 from a number of different workbooks (all in the same folder) and put them into a new workbook.
  2. Worksheet 2 has the same name in each of the different workbooks so I want the VBA to also change the name of the new worksheet to a cell reference from the original worksheet (in this case cell A6)
  3. Worksheet 3 has the same name in each of the different workbooks so I want the VBA to also change the name of this new worksheet to the same cell reference (A6), combined with the text "ph"

Any help would be gratefully received

Rob

Upvotes: 0

Views: 911

Answers (1)

mjacket
mjacket

Reputation: 65

You'll be able to figure out all of the code you need with the help of the Macro Recorder. Turn that on and manually do your listed steps (make sure you stop recording when that's done), then look for pieces of code that move the worksheets and rename them. Once you see that code, you can figure out how to customize it to your needs.

Upvotes: 0

Related Questions