Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-23-2016, 08:12 AM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Counting rows with a macro? Windows XP Counting rows with a macro? Office 2007
Competent Performer
Counting rows with a macro?
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default Counting rows with a macro?

In this thread, Andrew Lockton posts a macro that will display the number of rows in a selected table:



https://www.msofficeforums.com/word/...ows-table.html

The macro is:
Code:
Sub CountRows()
   msgbox Selection.Tables(1).Rows.Count
End Sub
Is there a way to make this into a function that will return the number of rows in a table if called from a cell in that table?
Reply With Quote
  #2  
Old 08-23-2016, 03:00 PM
macropod's Avatar
macropod macropod is offline Counting rows with a macro? Windows 7 64bit Counting rows with a macro? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

See the Identifying Table Cell Addresses 'Sticky' thread in the Word Tables forum: https://www.msofficeforums.com/word-...addresses.html. The macro there identifies both the addresses spanned by the selected range and the address of the last cell in the table (which includes both the column letter and row number).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting rows with a macro? Counting table rows in a page RavenSuzumiya Word Tables 1 06-09-2016 03:38 PM
VBA merging cells and counting Merged rows Snaybot Excel Programming 2 11-09-2015 03:56 AM
Counting unique visitors by ward, counting monthly visits by status, editing existing workbook JaxV Excel 9 11-14-2014 12:25 AM
Counting rows with a macro? Looking for VBA or Macro Counting a specific value occuring in single, random, changing cell? blackjack Excel Programming 1 09-11-2014 11:27 PM
Word counting macro for newly added portion? New Daddy Word VBA 24 09-30-2013 07:30 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft