Determine the row and column of the cursor

H

hals_left

Hi

How do I access the column and row number properties of:
selection.cells(1)

Also is there a way to create an event that fires when the user tabs out of a cell.

Thanks
hals_left
 
K

Klaus Linke

Hi hals_left,
How do I access the column and row number properties of:
selection.cells(1)

Check out the .Information property:

With Selection.Cells(1).Range
MsgBox .Information(wdStartOfRangeColumnNumber),,"Column"
MsgBox .Information(wdStartOfRangeRowNumber),,"Row"
End With
Also is there a way to create an event that fires when the user tabs out
of a cell.

Not strictly a kind of event handling, but you can intercept the built-in
command "NextCell" that runs whenever a user uses the tab key in a table:

Sub NextCell()
MsgBox "Running NextCell..."
WordBasic.NextCell
End Sub

Greetings,
Klaus
 
J

Jezebel

Apart from the Information function that Klaus suggests, the cell also has
ColumnIndex and RowIndex properties:

Selection.Cells(1).RowIndex, .ColumnIndex

The WindowSelectionChange event fires when the user tabs out of a cell.
 
H

hals_left

Thanks - just what I was after.

Jezebel said:
Apart from the Information function that Klaus suggests, the cell also has
ColumnIndex and RowIndex properties:

Selection.Cells(1).RowIndex, .ColumnIndex

The WindowSelectionChange event fires when the user tabs out of a cell.
 

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