Cell referencing

J

Janice

If you open an Excel spreadsheet you get labels
alphabetically across the top and numerically down the
side to make it easy to address a cell. When using a
table in Word is there any way to display this kind of
label so I don't have to count rows, columns, etc., to
find the address of a cell? Thanks for any help you can
provide.
 
G

Graham Mayor

What you need is the Table Cell Helper that was supplied with Word 97 in
Macros8.dot
The code is reproduced below:

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

See http://www.gmayor.dsl.pipex.com/installing_macro.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
E-mail (e-mail address removed)
Web site www.gmayor.dsl.pipex.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
S

Suzanne S. Barnhill

The macro is also available at
http://www.mvps.org/word/FAQs/AppErrors/SumAboveIncorrect.htm. But some
active display of cell addresses (I've long advocated that it be displayed
on the status bar) is desperately needed in Word. If you agree, write to
(e-mail address removed) and add your vote for this suggestion.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.mvps.org/word
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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