Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Macro for Counting the number of records in a worksheet

I need to count the number of records in worksheet leaving the empty rows
using VBA code.Is there anyway to do it?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro for Counting the number of records in a worksheet


hi

Assuming the data is in column A

Sub test()
rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
MsgBox rowcount
End Sub


--
jetted
------------------------------------------------------------------------
jetted's Profile: http://www.excelforum.com/member.php...o&userid=17532
View this thread: http://www.excelforum.com/showthread...hreadid=558896

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Macro for Counting the number of records in a worksheet

If you just want to count cells with values in column A you could do like
this:

Sub Test()
Dim iLastRow As Long
Dim i As Long

Range("C3").Value = 0

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If Cells(i, "A").Value < "" Then
Range("C3").Value = Range("C3").Value + 1
End If
Next i

End Sub



"jetted" wrote in
message ...

hi

Assuming the data is in column A

Sub test()
rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
MsgBox rowcount
End Sub


--
jetted
------------------------------------------------------------------------
jetted's Profile:
http://www.excelforum.com/member.php...o&userid=17532
View this thread: http://www.excelforum.com/showthread...hreadid=558896



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
Counting the number of errors in a worksheet Bob Excel Worksheet Functions 7 November 8th 07 10:22 AM
Help a novice with counting number of records TheBoz Excel Discussion (Misc queries) 3 November 14th 06 04:20 AM
Macro for counting the number of filtered rows DGillham[_5_] Excel Programming 4 January 9th 06 02:08 PM
Counting the number of times a word appears in a worksheet Jig Bhakta Excel Worksheet Functions 4 February 3rd 05 03:01 AM
use macro to append records to worksheet goingtospace Excel Programming 0 December 2nd 04 01:12 PM


All times are GMT +1. The time now is 08:43 AM.

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

About Us

"It's about Microsoft Excel"