Fix lastDataRow calculation
This commit is contained in:
@@ -368,8 +368,15 @@ Sub ExportMasterDetailData()
|
|||||||
Dim ws As Worksheet
|
Dim ws As Worksheet
|
||||||
Set ws = ActiveSheet
|
Set ws = ActiveSheet
|
||||||
|
|
||||||
|
' Find actual last row with data
|
||||||
Dim lastDataRow As Long
|
Dim lastDataRow As Long
|
||||||
lastDataRow = ws.Cells(ws.Rows.Count, "C").End(xlUp).Row
|
Dim r As Long
|
||||||
|
lastDataRow = 6
|
||||||
|
For r = 7 To 10000
|
||||||
|
If Trim(ws.Cells(r, 3).Value) <> "" Then
|
||||||
|
lastDataRow = r
|
||||||
|
End If
|
||||||
|
Next r
|
||||||
|
|
||||||
If lastDataRow < 7 Then
|
If lastDataRow < 7 Then
|
||||||
MsgBox "No data rows to output.", vbExclamation
|
MsgBox "No data rows to output.", vbExclamation
|
||||||
|
|||||||
Reference in New Issue
Block a user