Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2008

Tip: Looking for answers? Try searching our database.

Going to specific cells in a table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Doc60 - 18 Jan 2008 16:29 GMT
I would like to know how I can program into a macro the ability for the
cursor to goto a specifc cell in a table. For example cell F5.

Thank you
Greg Maxey - 18 Jan 2008 16:37 GMT
Sub ScratchMacro()
Selection.Tables(1).Cell(5, 6).Range.Select 'For the current table
Selection.Collapse wdCollapseStart
'Or
ActiveDocument.Tables(1).Cell(5, 6).Range.Select 'For the first table in the
document
Selection.Collapse wdCollapseStart
End Sub

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> I would like to know how I can program into a macro the ability for
> the cursor to goto a specifc cell in a table. For example cell F5.
>
> Thank you
fumei - 18 Jan 2008 19:52 GMT
Or, depending on your requirements, use a bookmark.  If a cell is bookmarked,
and it is named "test", you can move the Selection to it, and select it by:

Selection.GoTo what:=wdGoToBookmark, Name:="test"

If you want to move the Selection to it, but NOT select it - ie. you want the
cursor at the start of it:

Selection.GoTo what:=wdGoToBookmark, Name:="test"
Selection.Collapse Direction:=wdCollapseStart

If you want to simply display the content of what it there, and again the
cell is bookmarked as "test"

MsgBox ActiveDocument.Bookmarks("test").Range.Text

BTW:  I will assume by cell F5 you mean Row 6, Column 5.  Word is not Excel.

>I would like to know how I can program into a macro the ability for the
>cursor to goto a specifc cell in a table. For example cell F5.
>
>Thank you
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.