Add the sub to your module, then call it from the appropriate place in the PostEntry procedure like this
VBA Code:
Call DeleteEmptyTableRows
You could also make the table name an argument like this: Call DeleteEmptyTableRows(LOName) if the table name is dynamic.
Where (which line) in the PostEntry procedure do you want to delete empty table rows?
Dear Joe, considering my very limited knowhow of VBA, i used the attached code and got the following error:
Sub PostEntry()
'
' PostEntry Macro
'
' Keyboard Shortcut: Ctrl+Shift+Q
'
Application.ScreenUpdating = False
With ActiveSheet
.Unprotect "7860"
Range("D9:P12").Select
Selection.Copy
Range("D32").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("g9:g9").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("g6:g6").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("j9
12").Select
Application.CutCopyMode = False
Selection.ClearContents
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
Range("D20:P23").Select
Selection.Copy
Range("D32").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("F20:O23").Select
Application.CutCopyMode = False
Selection.ClearContents
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
Range("E32").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range(Selection, Selection.End(xlDown)).Select
Range("Table20[[#Headers],[Trxn Ref]]").Select
Range("d4").Select
Call DeleteEmptyTableRows
.Protect "7860"
End With
End Sub
Sub DeleteEmptyTableRows()
Dim LO As ListObject, Rw As Range, Remov As Range
Set LO = ActiveSheet.ListObjects("Table20") 'Change table name to suit
If Application.CountA(LO.DataBodyRange) = 0 Then Exit Sub
For Each Rw In LO.DataBodyRange.Rows
If Application.CountA(Rw) = 0 Then
If Remov Is Nothing Then
Set Remov = Rw
Else
Set Remov = Union(Remov, Rw)
End If
End If
Next Rw
Remov.Delete shift:=xlUp
End Sub