View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default VBA question - Type Mismatch

That would give the number of rows in the used range--not always the last used
row.

If your data were in A99:A100, you'd get 2.

Maybe

Dim lngLastRow As Long
with activesheet
lngLastRow = .UsedRange.rows(.usedrange.rows.count).row
end with

just in case??


Bill Renaud wrote:

Dim lngLastRow As Long

lngLastRow = ActiveSheet.UsedRange.Rows.Count

--
Regards,
Bill

"ajliaks " wrote in message
...
Plz,

I am trying to use this, but getting error!

I need to get the last active row in the active sheet

Dim LastRow As Integer

LastRow =
Workbooks(ActiveWorkbook.Name).Worksheets(ActiveSh eet).Cells(Rows.Count,
"1").End(xlUp).Row

May be its because of the "1" ???

Thanks.


---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson