Consulting

Results 1 to 5 of 5

Thread: Solved: find the FIRST used row and column

  1. #1

    Talking Solved: find the FIRST used row and column

    Last_Col = Cells.Find("*", SearchOrder:=xlByColumns, LookIn:=xlValues, SearchDirection:=xlPrevious).Column
    Last_Row = Cells.Find("*", SearchOrder:=xlByRows, LookIn:=xlValues, SearchDirection:=xlPrevious).Row
    i am using this code to find the LAST USED row/column,
    is there code to find the FIRST USED row/column?

    thanks.

    Picco

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]
    set rng = activesheet.usedrange
    firstrow = rng.row
    firstcol = rng.column
    [/vba]

  3. #3
    '... The First Column and First Row used in the sheet
    			Set Rng = ActiveSheet.UsedRange
    			First_Row = Rng.Row
    			First_Col = Rng.Column
    			Set Rng = Nothing
    thanks xld

  4. #4
    '... The First Column and First Row used in the sheet
    			Set Rng = ActiveSheet.UsedRange
    			First_Row = Rng.Row
    			First_Col = Rng.Column
    			Set Rng = Nothing
    Is this the quickest way to do this?

    i.E i notice i am setting an object

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by crmpicco
    '... The First Column and First Row used in the sheet
    			Set Rng = ActiveSheet.UsedRange
    			First_Row = Rng.Row
    			First_Col = Rng.Column
    			Set Rng = Nothing
    Is this the quickest way to do this?

    i.E i notice i am setting an object
    Whichever way you use, you will not be able to discern a difference, we are talking milli-seconds here.

Posting Permissions

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