Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default 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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
In Excel 2007 chart with multiple lines, mouse doesn't track lines sfuelling Charts and Charting in Excel 1 August 19th 09 09:41 PM
inserted lines move how to place lines in proper cell? Deschi Excel Worksheet Functions 0 February 8th 09 01:15 PM
need to assign a nomber to yes such as y=1 to run a count ? excel richard V New Users to Excel 3 October 24th 07 03:27 PM
Inserting Lines or Copying lines with formulas but without data wnfisba Excel Discussion (Misc queries) 2 August 18th 06 04:41 PM
excel97 vba to append lines to text file overwriting last 2 lines Paul Excel Programming 1 November 6th 04 08:11 PM


All times are GMT +1. The time now is 01:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"