hello to one and all, and thank you for a little help. I'm a novice and have learned code on my own (ugh) but I've used Excel recording macros as a start, and read what I needed from articles across the net. I'll post the excel recording of what I'm doing, and the variables. I'm copying a sheet from a master file, putting it into a new file, and then creating additional copies of the same tab in the new file. This approximates our electronic batch making file process in the plant. I'm just trying to automate it. Example: Batches 1 - 4 from formula Dog123. Copy tab Dog123 in the master file, open new file, paste copy of Dog123 in the new file, give the tab the header Dog123 (1), the copy Dog123 (1) three more times changing the header for the tab each time to Dog123 (2), Dog123(3)... Sorry about being long winded here, but its hard to describe.
Thanks for the input:
Using Formula from a spreadsheet and pulling it into the name of the sheet
Using count to add the extra labeling to the tab name and also count how many times to repeat the process before going to the next batch
AddMoreSheets:
Sheets(Formula).Select
Sheets(Formula & Count).Copy Before:=Sheets(Count)
Sheets("Formula & (Count + 1)").Select
Range("H2").Select
ActiveCell.FormulaR1C1 = "Count +1"
If Count > NoBatches Then GoTo Meals
Count = Count + 1
GoTo AddMoreSheets
This section came from the recording
'Sheets("FR 2").Select
'Sheets("FR 2").Copy Before:=Sheets(2)
'Sheets("FR 2 (2)").Select
'Range("H2").Select
'ActiveCell.FormulaR1C1 = "2"
'Range("H3").Select
'Sheets("FR 2 (2)").Select
'Sheets("FR 2 (2)").Copy Before:=Sheets(3)
'Sheets("FR 2 (3)").Select
'Range("H2").Select
'ActiveCell.FormulaR1C1 = "3"