Graham Mayor

... helping to ease the lives of Microsoft Word users.

Many people access the material from this web site daily. Most just take what they want and run. That's OK, provided they are not selling on the material as their own; however if your productivity gains from the material you have used, a donation from the money you have saved would help to ensure the continued availability of this resource. Click the appropriate button above to access PayPal.

Cell Finder add-in for Word

When programming in Word VBA to address tables, especially tables that have cells merged vertically or horizontally, it can be confusing to determine which cell is being addressed.

Take the following table:

Here you may wish to address the indicated cell. As the table has merged cells, you cannot address it with vba using its column and row position, but you can address it by cell number e.g.

Dim oTable As Table
Dim oCell As Range
Set oTable = ActiveDocument.Tables(1)
Set oCell = oTable.Range.Cells(n).Range
oCell.End = oCell.End - 1
MsgBox oCell.Text

where 'n' is the number of the cell. But what is that cell's number here?

This is where the add in comes in as it simply displays the cells by number and lists their contents with the selected cell highlighted.

That's simple, you may think, and so it is in the simple table above, but it gets altogether more complicated when working with forms that may contain many rows and columns randomly merged,

Thus the cell in question is number 5.

And that's really all there is to it.

The add-in puts a button on the context sensitive Table Layout tab of the ribbon

 

- Click here to download the add-in

 

Cell Finder

This simple add-in was developed to aid in the production of work I undertook for private clients.

Essentially it is a tool that identifies the cell number of a selected cell in a Word table for use in VBA programming. particularly where table cells have been merged, thus tending to confuse the cell numbering.