Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-17-2022, 01:38 AM
abonsey abonsey is offline vba table valid row count Windows 11 vba table valid row count Office 2021
Novice
vba table valid row count
 
Join Date: May 2022
Posts: 6
abonsey is on a distinguished road
Default vba table valid row count

Hi,

I'm supplied Word documents that contain a table that has differing valid rows therefore I need a variable to count the valid rows.
In Excel this would be something like:

Sub Test()
With ActiveSheet
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
MsgBox lastRow
End With
End Sub


I can use the following within word vba to count rows excluding the header row but I don't appear to be able to get .End(xlUP)

Dim row As Integer

Dim excelApp As Object

Set excelApp = CreateObject("Excel.Application")



row = excelApp.Worksheetfunction.Clean(ActiveDocument.Ta bles(1).UsedRange.Rows.Count




Any ideas how I can get a count of valid rows (based on Column 1)?



TIA
Reply With Quote
  #2  
Old 05-17-2022, 08:47 AM
abonsey abonsey is offline vba table valid row count Windows 11 vba table valid row count Office 2021
Novice
vba table valid row count
 
Join Date: May 2022
Posts: 6
abonsey is on a distinguished road
Default

??Any ideas anyone??

I did have this, but it failed at the 'With ActiveDocument.InlineShapes(1)' yet it worked on the other person's vba

Dim objSS As InlineShape
With ActiveDocument.InlineShapes(1)
.OLEFormat.DoVerb wdOLEVerbHide
With .OLEFormat.Object.Application
With .workbooks(1).Worksheets(1)
MsgBox .Range("A1").currentregion.Rows.Count
End With
End With
End With


TIA
Reply With Quote
  #3  
Old 05-17-2022, 03:16 PM
macropod's Avatar
macropod macropod is offline vba table valid row count Windows 10 vba table valid row count Office 2016
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 at the top of the Word Tables page: https://www.msofficeforums.com/word-...addresses.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
cells word vba, vba tables macro

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
vba table valid row count Why does the total row of my pivot table not tie to the real count using distinct count wheddingsjr Excel 4 09-01-2020 09:52 PM
vba table valid row count Inserting a formula to count 30 days before and after a date in WORD table bjh894 Word 9 05-18-2020 11:14 AM
Looking for a macro for word count in one specific column of table, only rows with white background mobj Word VBA 2 10-17-2019 03:09 AM
simple way to count rows in a table? bkcell Word 4 03-09-2015 09:06 PM
Is it possible to count the columns between two points on a table? bobsone1 Excel 2 08-14-2014 01:42 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:20 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