I apologize if this question has been answered previously. I'm new to the forum here and couldn't find a complete answer. I have the code below. With it, I want to count the number of cells in a range that are = "#N/A".
Sub Count()
ActiveSheet.Select
Var = Count("#N/A", Range("E1:E200"))
Function Count(find As String, lookin As Range) As Long
Dim cell As Range
For Each cell In lookin
If (cell.Value = find) Then Count = Count + 1
Next
End Function
End Sub
From there I want to be able to use the result as the number of rows to insert on a different sheet, using the code below. This code works to insert a single cell, but incorporating the above code and this has really thrown me off. Thanks to anyone who can help.
Sub InsertRows()
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Offset().EntireRow.Insert
End Sub
Bookmarks