Hi,
I have copy and pasted the code supplied by Fotis on the post:
Into my main model and I get a the error "Compile Error - Variable not defined"
How do I correct this?
Sub Test()
ActiveSheet.Cells.UnMerge
For N = ActiveSheet.UsedRange.Rows.Count To 4 Step -1
If InStr(Cells(N, 1), "APP024") > 0 Then
Rows(N).Delete
End If
If WorksheetFunction.CountA(Rows(N)) = 0 Then
Rows(N).Delete
End If
If InStr(Cells(N, 1), "APP024") > 0 Or InStr(Cells(N, 1), "Retail") > 0 Or InStr(Cells(N, 1), "Period") > 0 Or InStr(Cells(N, 1), "Code") > 0 Or InStr(Cells(N, 1), "Page") > 0 Then
Rows(N).Delete
End If
If InStr(Cells(N, 1), "Sub-total") > 0 Then
Rows(N).Font.Bold = True
Rows(N).Font.ColorIndex = 3
Rows(N).Font.Underline = xlUnderlineStyleDoubleAccounting
End If
Next N
With Sheets("APP024")
.Columns("B:B").ColumnWidth = 30
.Columns("A:A").ColumnWidth = 10
.Columns("C:H").ColumnWidth = 10
.Rows("4:6").Insert Shift:=xlDown
Range("A7") = "Code"
Range("B7") = "Business"
Range("C7") = "Ex VAT £"
Range("D7") = "VAT £"
Range("E7") = "INC VAT £"
Range("F7") = "Ex VAT £"
Range("G7") = "VAT £"
Range("H7") = "INC VAT £"
Range("C6:E6").Merge
Range("F6:H6").Merge
Range("C6:E6") = "Contributions From"
Range("F6:H6") = "Contributions To"
Range("A6:H7").Font.Bold = True
End With
End Sub
Bookmarks