Kindly edit 2nd line of a code as mentioned below code to add a condition to select
If worksheet "Data" A1 = format1 then select -Worksheets("format1").Copy
If worksheet "Data"A1=Format2 then select -Worksheets("format1").Copy
If worksheet "Data"A1=Format3 then select -Worksheets("format3").Copy
If worksheet "Data"A1=Format4 then select -Worksheets("format4").Copy
If worksheet "Data" A1 = format1 then select -Worksheets("format1").Copy
If worksheet "Data"A1=Format2 then select -Worksheets("format1").Copy
If worksheet "Data"A1=Format3 then select -Worksheets("format3").Copy
If worksheet "Data"A1=Format4 then select -Worksheets("format4").Copy
Code:
For i = 6 To lastRow
Worksheets("format1").Copy after:=Worksheets(Worksheets.Count)
With ActiveSheet
wsName = Replace(Replace(Replace(Replace(Replace(Replace(Replace(wsName, ":", ""), "/", ""), "\", ""), "?", ""), "*", ""), "[", ""), "]", "")
wsName = Left(ws.Range("C" & i).Value, 31)
.Name = wsName
.Range("G6").Formula = "=""Date : ""&Data!D1"
Last edited: