hi pleae can someone tell me what is wrong with this code. im counting mumber of blank cells in a range and keeps crashing out on Runtime error, overflow at line
blnkrowcount = WorksheetFunction.CountBlank(ws.Range("ay:hy"))
Dim k As Long
Dim y As Integer
Dim blnkrowcount As Integer
y = Lrow
For k = Lrow To 1 Step -1
blnkrowcount = WorksheetFunction.CountBlank(ws.Range("ay:hy"))
If blnkrowcount <> 0 Then
Sheets("Invoices").Select
Rows(k).Select
Selection.Delete Shift:=xlUp
End If
y = y - 1
Next k
End Sub
your text
to set range by using the variable y (originally k but didtn work so tried making a new variable
Also tried & and setting a range variable all without success.
New contributor
Mark Andrew Coombes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.