Need to complete the following macro as not able to meet the final condition:

aashish83

Board Regular
Joined
Feb 15, 2022
Messages
62
Office Version
  1. 365
Platform
  1. Windows
Condition 1 - to copy selected sheets to a new workbook and Save it in the same location with a fixed name – Sorted with below Blue Text



Condition 2 – Create multiple new sheets in the condition 1 workbook and rename from the range mentioned below in Green Just having issue with the highlighted red part as it always creates one extra sheet apart from the range mentioned as sheet20 or 21 or some other number



Condition 3 - Which I am struggling with is that sheets created in condition two should actually be a copy of Audit Form FSR B which we generated in condition 1 and renamed as per range mentioned in condition 2



Sub FSRB()

With ActiveWorkbook.Sheets(Array("FSR Level B", "BI"))

.Copy

ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & Application.PathSeparator & "Audit Form FSR B", FileFormat:=52

End With


Dim sheets_count As Integer

Dim sheet_name As String

Dim i As Integer

sheet_count = Range("B17:B70").Rows.Count

For i = 1 To sheet_count

sheet_name = Sheets("BI").Range("B17:B70").Cells(i, 1).Value


Worksheets.Add().Name = sheet_name

Next i

End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,214,875
Messages
6,122,044
Members
449,063
Latest member
ak94

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top