Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-09-2017, 08:11 AM
Hdata Hdata is offline GoTo Cell Reference in wdTable Windows 7 32bit GoTo Cell Reference in wdTable Office 2010 32bit
Novice
GoTo Cell Reference in wdTable
 
Join Date: Jan 2014
Posts: 26
Hdata is on a distinguished road
Default GoTo Cell Reference in wdTable

Thanks in advance for solving my request: I'm looking for VBA code that would send me to a specific cell within a word table. In other words, when I launch this code a text box will appear where I could insert say (Cell 32,4) then click go and the cursor would end up at that specific cell. Thanks so much. (Office 2013)



Hdata
Reply With Quote
  #2  
Old 02-09-2017, 02:09 PM
macropod's Avatar
macropod macropod is offline GoTo Cell Reference in wdTable Windows 7 64bit GoTo Cell Reference in wdTable Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Going to a cell would only be necessary if you need to select something there, which is usually not necessary when working in VBA. So, perhaps you could explain what you're trying to achieve?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-09-2017, 09:27 PM
Hdata Hdata is offline GoTo Cell Reference in wdTable Windows 7 32bit GoTo Cell Reference in wdTable Office 2010 32bit
Novice
GoTo Cell Reference in wdTable
 
Join Date: Jan 2014
Posts: 26
Hdata is on a distinguished road
Default

Yes, I have word tables previously setup with updateable cell formulas. I also have a list of cell references which I would like to GoTo in order to update these formulas.

Essentially you have hit the nail on the head. I want to select the contents of that cell or a range of cells in order to update formulas within that cell or range of cells without updating the entire table.

Thanks for your expertise regarding VBA code. (Hdata)
Reply With Quote
  #4  
Old 02-10-2017, 03:02 AM
gmayor's Avatar
gmayor gmayor is offline GoTo Cell Reference in wdTable Windows 10 GoTo Cell Reference in wdTable Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You probably want something like

Code:
Dim oTable As Table
Dim oCell As Cell
    If ActiveDocument.Tables.Count > 0 Then
        Set oTable = ActiveDocument.Tables(1)    'the first table
        Set oCell = oTable.Cell(1, 1)    'Row 1, Column 1
        oCell.Range.Fields.Update
    End If
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #5  
Old 02-10-2017, 05:21 AM
macropod's Avatar
macropod macropod is offline GoTo Cell Reference in wdTable Windows 7 64bit GoTo Cell Reference in wdTable Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Hdata View Post
Yes, I have word tables previously setup with updateable cell formulas. I also have a list of cell references which I would like to GoTo in order to update these formulas.
You don't need to 'Goto' or 'Select' anything for this. All you need is something like:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim ArrTbls, ArrRows, ArrCols, i As Long
ArrTbls = Array(1, 1, 3, 3, 4, 5)
ArrRows = Array(6, 8, 6, 8, 6, 6)
ArrCols = Array(4, 4, 5, 7, 2, 2)
With ActiveDocument
  For i = 0 To UBound(ArrTbls)
    .Tables(ArrTbls(i)).Cell(ArrRows(i), ArrCols(i)).Range.Fields.Update
  Next
End With
Application.ScreenUpdating = True
End Sub
With this code, you use three arrays, one each for the tables, rows & columns to be updated. Each array contains its respective table index, row index and cell index for the cells you want to update. In the above demo, the first set of array entries points to table 1, row 6 column 4, the second set of array entries points to table 1, row 8 column 4, and so on.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 02-10-2017, 05:31 AM
Hdata Hdata is offline GoTo Cell Reference in wdTable Windows 7 32bit GoTo Cell Reference in wdTable Office 2010 32bit
Novice
GoTo Cell Reference in wdTable
 
Join Date: Jan 2014
Posts: 26
Hdata is on a distinguished road
Default

Thanks Graham
Reply With Quote
  #7  
Old 02-10-2017, 05:34 AM
Hdata Hdata is offline GoTo Cell Reference in wdTable Windows 7 32bit GoTo Cell Reference in wdTable Office 2010 32bit
Novice
GoTo Cell Reference in wdTable
 
Join Date: Jan 2014
Posts: 26
Hdata is on a distinguished road
Default

Thanks Paul
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
GoTo Cell Reference in wdTable Reference Word Table Cell Using Offset? wlcdo2 Word VBA 2 06-19-2016 08:53 PM
GoTo Cell Reference in wdTable Assign the value of a cell as a cell reference of another cell in Excel 2010 - How to? bharathkumarst Excel 7 10-13-2014 10:25 AM
Locking A Cell Reference Regardless skoz55 Excel 8 05-16-2014 09:15 AM
GoTo Cell Reference in wdTable Keeping an absolute reference in a cell bremen22 Excel 7 01-16-2014 11:06 AM
GoTo Cell Reference in wdTable How to reference a cell value Jmoney2290 Excel 1 11-06-2013 09:39 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft