Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 05-21-2014, 09:44 AM
gmaxey gmaxey is offline Referencing rows of a table at a bookmarked location based on the value of a column Windows 7 32bit Referencing rows of a table at a bookmarked location based on the value of a column Office 2010 (Version 14.0)
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

On second thought this might be better. This way you can use non-uniform tables:

Code:
Sub ScratchMacro()
Dim oTbl As Word.Table, oTblTarget As Table
Dim arrIndex() As Long
Dim lngIndex As Long
Dim oRng As Word.Range
  Set oTbl = ActiveDocument.Tables(1)
  oTbl.Range.Copy
  Set oRng = ActiveDocument.Bookmarks("bmRows").Range
  If oRng.Tables.Count = 1 Then
    oRng.Tables(1).Delete
  End If
  oRng.Paste
  Set oTblTarget = oRng.Tables(1)
  ActiveDocument.Bookmarks.Add "bmRows", oTblTarget.Range
  ReDim arrIndex(0)
  For lngIndex = oTbl.Rows.Count To 1 Step -1
    If Not Left(oTbl.Cell(lngIndex, 1).Range.Text, Len(oTbl.Cell(lngIndex, 1).Range.Text) - 2) = "High" Then
      arrIndex(UBound(arrIndex)) = oTbl.Rows(lngIndex).Index
      ReDim Preserve arrIndex(UBound(arrIndex) + 1)
    End If
  Next lngIndex
  For lngIndex = 0 To UBound(arrIndex) - 1
    oTblTarget.Rows(arrIndex(lngIndex)).Delete
  Next lngIndex
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 

Tags
bookmark, rows, table



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouseover cell to indicate mouse pointer location based on Specific Row/Column values bolandk Excel 1 05-15-2014 08:22 AM
Group Table Rows/Column (like Excel Group) eoinymc Word 1 03-11-2014 04:51 AM
Referencing rows of a table at a bookmarked location based on the value of a column Need help on duplicates in column; deciding which to keep based on other column nwcf Excel 3 01-31-2014 09:43 AM
Referencing rows of a table at a bookmarked location based on the value of a column Grouping table rows to prevent individual rows from breaking across pages dennist77 Word 1 10-29-2013 11:39 PM
Referencing rows of a table at a bookmarked location based on the value of a column Referencing a Image File and Location matt8445 PowerPoint 2 11-08-2012 08:23 AM

Other Forums: Access Forums

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