Help - Save-invoice-data1.xlsThis is my first time trying to use a macro and i am running into a issue. The below macro will ignore the rows if it is completely blank with no formulas. However i have formulas in ever cell for example =IF(K21="","",VLOOKUP(K21,Data!A:B,2,0)*J21). Even though in the formula i am telling the cell to be blank the macro is not reading it as a blank. Any help would be greatly appreciated.
Sub Button2_Click()
Dim rng As Range
Dim temp As Variant
Dim i As Long
Dim a As Long
Dim rng_dest As Range
Application.ScreenUpdating = False
i = 1
Set rng_dest = Sheets("Invoice data").Range("A:R")
' Find first empty row in columns A:R on sheet Invoice data
Do Until WorksheetFunction.CountA(rng_dest.Rows(i)) = 0
i = i + 1
Loop
'Copy range B21:S37 on sheet Invoice to Variant array
Set rng = Sheets("Invoice").Range("B21:S37")
' Copy rows containing values to sheet Invoice data
For a = 1 To rng.Rows.Count
If WorksheetFunction.CountA(rng.Rows(a)) <> 0 Then
rng_dest.Rows(i).Value = rng.Rows(a).Value
i = i + 1
End If
Next a
Application.ScreenUpdating = True
Bookmarks