Thread: [Solved] vba table valid row count
View Single Post
 
Old 05-17-2022, 01:38 AM
abonsey abonsey is offline Windows 11 Office 2021
Novice
 
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