![]() |
|
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
![]()
Hello Pros,
I've been trying all day to figure out how to select from all tables the range as of rows(1) and Column(2), till the end of the table, on all tables. I found a script where I've modified it with my needs How to select a range of the second row to the last row Word VBA - Stack Overflow Where I've coded this script which works well for 1 table: Code:
Dim aTbl As Table Set aTbl = ActiveDocument.Tables(1) Dim NewTable As Boolean 'if not new Table Select All but first row, Else Select whole table If NewTable = 0 Then With aTbl ActiveDocument.Range(.Cell(1, 2).Range.Start, .Rows(.Rows.Count).Range.End).Select End With Else aTbl.Select End If On Error GoTo 0 However, when applied too all table, I've modified it to this script: Code:
Dim xTbl As Table For Each xTbl In ActiveDocument.Tables Dim NewTable As Boolean 'if not new Table Select All but first column, Else Select whole table If NewTable = 0 Then With xTbl ActiveDocument.Range(.Cell(1, 2).Range.Start, .Rows(.Rows.Count).Range.End).Select End With Else xTbl.Select End If Next xTbl On Error GoTo 0 To test potential scripts, I've used 5 columns and 5 rows, x5 tables. Any idea how to fix this issue? I would be sooooooooo greatful for any insights to help me with my script. Cendrinne |
Tags |
all tables, help please, range.rows |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Cendrinne | Word VBA | 15 | 03-22-2021 06:45 PM |
![]() |
IIOII | Word VBA | 8 | 07-20-2016 11:28 PM |
![]() |
bretyuin | Excel | 1 | 02-24-2016 05:11 AM |
VBA Word Table - Select More than 1 Column at a time - Apply Formatting | jc491 | Word VBA | 12 | 09-24-2015 06:03 AM |
Way to select a range using the mouse on a chart? | omahadivision | Excel Programming | 6 | 12-29-2012 09:21 AM |