Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 05-09-2017, 07:25 AM
gmaxey gmaxey is offline Nested tables. Count rows Windows 7 32bit Nested tables. Count rows Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

How about:

Code:
Sub subNumberTableColumns()
Dim oTbl As Table
Dim lngIndex As Integer
Dim oRng As Range
  On Error GoTo Error_subNumberTableColumns
  If Selection.Information(wdWithInTable) Then
  Set oTbl = Selection.Tables(1)
  For lngIndex = 1 To oTbl.Rows.Count - 1
    Set oRng = oTbl.Cell(lngIndex + 1, 1).Range
    oRng.InsertBefore lngIndex & ". "
  Next lngIndex
Else
  MsgBox "You must be in a table to number the table.", vbCritical, "Number Block"
End If
lbl_Exit:
 Exit Sub
Error_subNumberTableColumns:
  MsgBox "An unexpected situation arose in your program." & vbCrLf & _
        "Please write down the following details:" & vbCrLf & vbCrLf & _
        "Module Name: " & "(MODULE_NAME)" & vbCrLf & _
        "Type: VBA Document: " & vbCrLf & _
        "Calling Procedure: " & "(PROCEDURE_NAME}" & vbCrLf & _
        "Error Number: " & Err.Number & vbCrLf & _
        "Error Descritption: " & Err.Description & vbCrLf & vbCrLf & _
        "Resume Exit_" & "(PROCEDURE_NAME)"
  Resume lbl_Exit
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 

Tags
nested table



Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested tables. Count rows Getting the Count formula to count all rows Jennifer Murphy Word Tables 11 08-23-2016 09:37 PM
simple way to count rows in a table? bkcell Word 4 03-09-2015 09:06 PM
copying nested if over multiple rows where one value stays fixed charles_cat Excel 1 01-23-2015 01:30 AM
Nested tables. Count rows Count rows and add blank rows accordingly Hoochtheseal Word VBA 1 01-29-2013 09:23 PM
Nested vlookup with varable tables! Dave Jones Excel 0 08-30-2012 09:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:25 AM.


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