View Single Post
 
Old 10-19-2019, 09:06 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
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 ofgmayor has much to be proud of
Default

It is not quite the same as Excel, but as Greg suggests it is just a matter of setting a range to the place you want to process. e.g.

Code:
Sub Macro1()
Dim oTable As Table
Dim oCell As Range
Set oTable = ActiveDocument.Tables(1)    'where 1 is the first table
    'or
    'Set oTable = Selection.Tables(1) 'which is the table the cursor is in
    Set oCell = oTable.Rows(1).Cells(1).Range 'the first cell in the top row
    oCell.End = oCell.End - 1    'omit the cell end character from the range
    oCell.Text = UCase(oCell.Text)    'make the cell range upper case
    Set oCell = Nothing
    Set oTable = Nothing
End Sub
__________________
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