Hi evryone
need a VB code to find first empty row
and
first empty colomn.
apretiate any help
Khalil
Hi evryone
need a VB code to find first empty row
and
first empty colomn.
apretiate any help
Khalil
Hi Khalil,
Function FirstEmpty(what As String) As Long
Dim r As Range
If what = "row" Then
For Each r In ActiveSheet.Rows
If WorksheetFunction.CountA(r) = 0 Then
FirstEmpty = r.Row
Exit Function
End If
Next
ElseIf what = "col" Then
For Each r In ActiveSheet.Columns
If WorksheetFunction.CountA(r) = 0 Then
FirstEmpty = r.Column
Exit Function
End If
Next
End If
' no empty rows (or columns), return zero
FirstEmpty = 0
End Function
Sub test()
Debug.Print FirstEmpty("row")
Debug.Print FirstEmpty("col")
End Sub
Ed Ferrero
http://www.edferrero.com
> Hi evryone
>
> need a VB code to find first empty row
> and
> first empty colomn.
>
> apretiate any help
> Khalil
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks