ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   nomber of lines (https://www.excelbanter.com/excel-programming/316430-nomber-lines.html)

wasssu

nomber of lines
 

I have a sheet in excel and i want to know how many lines are "used
(used line = there is cell(s) with something in it).
How can i do that in Macro-VBA ? What is the "simplies(rapid) way"?
don't want to use a for, while or somethig like that

--
wasss
-----------------------------------------------------------------------
wasssu's Profile: http://www.excelforum.com/member.php...fo&userid=1605
View this thread: http://www.excelforum.com/showthread.php?threadid=27731


Nick Hodge

nomber of lines
 
wasssu

I normally do it this way (XL97 and up). It goes to the bottom of column A
and then up. This way it is not fooled if there is no data in some cells in
column A. You could of course use any column. It need to be the one you are
expecting the most data in. If this is variable, post back and we'll find
another solution

Sub findLastCell()
Dim lLastRow As Long
lLastRow = Range("A65536").End(xlUp).Row
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"wasssu" wrote in message
...

I have a sheet in excel and i want to know how many lines are "used"
(used line = there is cell(s) with something in it).
How can i do that in Macro-VBA ? What is the "simplies(rapid) way"? I
don't want to use a for, while or somethig like that.


--
wasssu
------------------------------------------------------------------------
wasssu's Profile:
http://www.excelforum.com/member.php...o&userid=16050
View this thread: http://www.excelforum.com/showthread...hreadid=277314




Gord Dibben

nomber of lines
 
wasssu

Sub CountNonBlankCells()
Dim mycount As Integer
mycount = Application.CountA(Selection)
MsgBox "The number of non-blank cell(s) in this selection is : " _
& mycount, vbInformation, "Count Cells"
End Sub

Gord Dibben Excel MVP

On Thu, 11 Nov 2004 04:22:42 -0600, wasssu
wrote:


I have a sheet in excel and i want to know how many lines are "used"
(used line = there is cell(s) with something in it).
How can i do that in Macro-VBA ? What is the "simplies(rapid) way"? I
don't want to use a for, while or somethig like that.



mudraker[_324_]

nomber of lines
 

GetBottomRow = TheSheet.Cells.Find(What:="*", SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row



LastColumn = TheSheet.Cells.Find(What:="*", SearchOrder:=xlByColumns
_
SearchDirection:=xlPrevious).Colum

--
mudrake
-----------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...nfo&userid=247
View this thread: http://www.excelforum.com/showthread.php?threadid=27731



All times are GMT +1. The time now is 05:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com