Sub Test()
Dim DestinationBook As Workbook
Dim strSaveName As String
Dim ws As Worksheet
Dim collValues As Collection
Dim rCell As Range
Dim i As Integer, icolumn As Integer
With ThisWorkbook
' my function to unprotect the sheet
ActiveWorkbook.UnProtect
.Worksheets("SMOE-FRONT").Copy
ActiveSheet.Cells.Copy
ActiveSheet.Range("A1").PasteSpecial Paste:=xlValues
.Worksheets("SMOE-BACK").Copy After:=ActiveWorkbook.Worksheets(ActiveWorkbook.Worksheets.Count)
ActiveSheet.Cells.Copy
ActiveSheet.Range("A1").PasteSpecial Paste:=xlValues
End With
Windows(GeneratorFile).Activate
ActiveWorkbook.Protect
'get the name to save
Windows(GeneratorFile).Activate
strSaveName = Worksheets("Configuration").Range("I56").Value
Application.Dialogs(xlDialogSaveAs).Show (strSaveName)
'This block reactivates the string counting in the label text
Sheets("SMOE-FRONT").Select
Range("T24:T25").Select
ActiveCell.FormulaR1C1 = "=LEN(RC[-10])"
Range("T24:T25").Select
ActiveWindow.SmallScroll Down:=6
Selection.AutoFill Destination:=Range("T24:T41"), Type:=xlFillDefault
Range("T24:T41").Select
ActiveWorkbook.Save
'To remove the blanks between lines
Set ws = Sheets("SMOE-FRONT")
For icolumn = 3 To 8
If Application.WorksheetFunction.CountA(ws.Range(ws.Cells(23, icolumn), ws.Cells(52, icolumn))) > 1 Then
Set collValues = New Collection
For Each rCell In ws.Range(ws.Cells(23, icolumn), ws.Cells(52, icolumn)).SpecialCells(xlCellTypeConstants)
collValues.Add rCell.Value
Next rCell
ws.Range(ws.Cells(23, icolumn), ws.Cells(52, icolumn)).ClearContents
For i = 1 To collValues.Count
ws.Cells(53, icolumn).End(xlUp).Offset(1, 0).Value = collValues.Item(i)
Next i
Set collValues = Nothing
End If
Next icolumn
Application.CutCopyMode = False
'end of code to remove blanks
ActiveWorkbook.Save
ActiveWindow.Close
Windows(GeneratorFile).Activate
ActiveWorkbook.protect
Sheets("Selector Homepage").Select
End Sub