So this code from Module 1 is the culprit you think?
Sub Main()
Dim i As Long
Dim j As Long
Dim LastRow As Long
Dim LastRow2 As Long
Dim x As Long
Dim strThisFileName As String
Dim FileOpenCheck As Boolean
FileOpenCheck = IsWorkBookOpen("1.xlsx")
If FileOpenCheck Then
Else
MsgBox "1.xlsx is not open", vbInformation
Exit Sub
End If
strThisFileName = ActiveWorkbook.Name
Call Import(strThisFileName)
Call DeleteBlanks
ActiveSheet.Range("B10").Select
' Finding LastRow based on column B
For i = 10 To 10000
If ActiveCell.Value = "" Then
Selection.EntireRow.Delete
ActiveCell.Offset(-1).Select
LastRow = i - 1
Exit For
End If
ActiveCell.Offset(1).Select
If i = 10000 Then
Exit For
End If
Next
'Select A10
ActiveSheet.Range("A10").Select
For i = 1 To 10000
If ActiveCell.Value = "" Then
Exit For
End If
x = ActiveCell.Row
For j = 0 To 9999
ActiveCell.Offset(1).Select
If ActiveCell.Value <> "" Or ActiveCell.Row > LastRow Then
LastRow2 = ActiveCell.Row - 1
ActiveSheet.Range(Cells(x, 2), Cells(LastRow2, 7)).Select
' Sort bits
Range(Cells(x, 2), Cells(LastRow2, 7)).Sort Key1:=Range(Cells(x, 2), Cells(LastRow2, 2)), Order1:=xlAscending, Header:=xlNo
Call zFormatCells2
ActiveSheet.Range(Cells(x, 1), Cells(LastRow2, 1)).Select
Call zFormatCells
ActiveCell.Offset(1).Select
Exit For
End If
Next
If x > LastRow Then
Exit For
End If
Next
Call GreyItOut
Workbooks(strThisFileName).Activate
Worksheets("EstimateOne").Visible = False
Worksheets("Pivot").Visible = False
Call MakeEmailHyperlink
Range("A10:A10000").Font.Size = 20
Range("A10:A10000").Font.Bold = True
Call AddFormula
ActiveSheet.Range("A10").Select
ActiveWindow.WindowState = xlMaximized
ActiveSheet.Shapes("Button 1").Delete
ActiveWorkbook.Save
Workbooks("1.xlsx").Close SaveChanges:=False
End Sub
Sub zFormatCells()
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
'Selection.Merge
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
End Sub
Sub zFormatCells2()
With Selection
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
End With
End Sub
Function IsWorkBookOpen(Name As String) As Boolean
Dim xlWb As Workbook
On Error Resume Next
Set xlWb = Application.Workbooks.Item(Name)
IsWorkBookOpen = (Not xlWb Is Nothing)
End Function