insert 'x' number of rows in excel

A

Al-Blakie

Hi,
I'm looking to insert 'x' no. of rows into an excel document where 'x' is
the result of a 'countA' function.

Is this possible?
 
D

Dave Peterson

How about:

Option Explicit
Sub testme()

Dim numOfRows As Long
Dim myRow As Long

myRow = 8 'or whereever you want it
With ActiveSheet
numOfRows = Application.CountA(.Range("a1:a3"))
If numOfRows > 0 Then
.Rows(myRow).Resize(numOfRows).Insert
End If
End With

End Sub
 
Top