+ Reply to Thread
Results 1 to 2 of 2

Empty Rows & colomns

  1. #1
    Khalil Handal
    Guest

    Empty Rows & colomns

    Hi evryone

    need a VB code to find first empty row
    and
    first empty colomn.

    apretiate any help
    Khalil



  2. #2
    Ed Ferrero
    Guest

    Re: Empty Rows & colomns

    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
    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1