How to display table cell references?

J

James DeHullu

I have not found a way to display the cell references for
tables in Word 2002. I am referring to the references such
as A1, B1, C1, A2, B2, etc. that identify each cell in a
table. Is there a way to display them?
 
D

Doug Robbins - Word MVP

Use the TableCellHelper macro that was included in the Macros8.dot and
Macros9.dot templates that were provided with earlier versions of Word. If
you do not have them, you can download them from

http://word.mvps.org/Downloads/index.htm

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
D

D Newsham

I also had the same question, so downloaded both Macros8.dot and Macros9.dot
as per your suggestion. The TableCellHelper macro isn't in either of these
two templates. Do you know of someplace else I can get that macro?

Thanks,
Dina
 
D

Doug Robbins - Word MVP

I have checked, and while it is not in Macros9, it is in Macros8.

However, here is the code:

Sub TableCellHelper()
'************************************
'* Declarations *
'* Section *
'************************************

Dim TC%, TR%, FC%, LC%, FR%, LR%, dummy%, Row%, Col%
Dim FTC&, LCT&
Dim Q1Dbl$, Q2Dbl$
Dim Msg1$, Msg2$, Msg3$, Msg4$, Msg5$, Msg6$, Title$

'************************************
'* Initialization *
'* Section *
'************************************

Msg3$ = "Your selection must be entirely within a single table."
Msg6$ = "Word cannot display the total columns and or rows because some
cells are either split or merged."
Title$ = "Table Cell Helper"

If Application.Documents.Count Then
If Selection.Information(wdWithInTable) Then
Col = Selection.Information(wdMaximumNumberOfColumns)
Row = Selection.Information(wdMaximumNumberOfRows)
FC = Selection.Information(wdStartOfRangeColumnNumber)
LC = Selection.Information(wdEndOfRangeColumnNumber)
FR = Selection.Information(wdStartOfRangeRowNumber)
LR = Selection.Information(wdEndOfRangeRowNumber)
FCT = FC / 26
Select Case FCT
Case 0 To 1
Q1Dbl = ""
Case Is <= 2
Q1Dbl = "A"
FC = FC - 26
Case Else
Q1Dbl = "B"
FC = FC - 52
End Select
LCT = LC / 26
Select Case LCT
Case 0 To 1
Q2Dbl = ""
Case Is <= 2
Q2Dbl = "A"
LC = LC - 26
Case Else
Q2Dbl = "B"
LC = LC - 52
End Select
Msg1$ = "At cell " & Q1Dbl & Chr$(Val(FC) + 64) & ":" & LR & "."
Msg2$ = "Selected cell range is " & Q1Dbl & Chr$(Val(FC) + 64) & FR
& ":" & Q2Dbl & Chr$(Val(LC) + 64) & LR & "."
Msg5$ = "There are a total of " & Col & " columns, and " & Row & "
rows in this table."
If FC = LC And FR = LR Then
dummy = MsgBox(Msg1$ & " " & Msg5$, vbOKOnly, Title$)
Else
dummy = MsgBox(Msg2$ & " " & Msg5$, vbOKOnly, Title$)
End If
Else
dummy = MsgBox(Msg3$, vbOKOnly, Title$)
End If
On Error GoTo TError
End If
Exit Sub

TError:
If Err = 5992 Then
dummy = MsgBox(Msg6$, vbOKOnly, Title$)
End If
Resume Next
End Sub


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
D

D Newsham

Thanks, it is indeed in Macros8. I had only looked at the list on the page
and not actually gone into the macros. Sorry about that! Thank you for
taking extra time to answer my question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top