A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
I guess, I can take B3 value from worksheet "Unique List" in the Macro workbook to fill B1 in the coversheet.
With wbOutput.Worksheets("Coversheet")
.Cells(3, "B") = rngUniqVal.Value 'Unique Number
.Cells(4, "B") = rngUniqVal.Offset(0, 1).Value 'Description
.Cells(1, "B") = "MCR-" & rngUniqVal.Value & "-002" 'Unique Number
End With
In the below code
For Each rngUniqVal In rngUnique
wbMacro.Sheets(2).Copy
Set wbOutput = ActiveWorkbook
With wbMacro
For s = 3 To .Worksheets.Count
.Worksheets(s).Copy After:=wbOutput.Worksheets(wbOutput.Worksheets.Count)
Next s
End With
Set wsOutput = wbOutput.Sheets("Output")
With wsOutput
lngLastRow = LastRow(.Cells)
If lngLastRow < 4 Then lngLastRow = 4
.Range(.Rows(4), .Rows(lngLastRow)).ClearContents
End With
wbMacro.Sheets(2).Copy
The above code will automatically create a new workbook? from the code I see cover sheet is being copied then workbooks.add and paste is required I was hoping.
.Range(.Rows(4), .Rows(lngLastRow)).ClearContents
wsOutput has no data yet why clear contents was used.
if LastRow(.Cells) = 4
Then Range(4, 4) .ClearContents I did not understand it.