Word vba code to return the position of the cell I'm in
Hi experts
I suspect this is probably simple, but I have no idea how to do it, or go about it.
I've selected a particular table and I want to find particular text in there. Then I want to go to that text and return the value of the cell I'm in, for example Row(4), Cell(2).
Can someone tell me how to do this.
Dim myrange As Rangeset myrange = ActiveDocument.Tables(2).Range myrange.Find.Execute findtext:=texta If myrange.Find.Found = True Then 'goto that text. What cell am I in? End If
As dotoffice has illustrated above, if you only want to select the cell, you don't need to know the address.
Fi69
ASKER
Yes, that is a much more simple way of doing what I've ended up doing. Sorry dotoffice I already awarded points. Thanks for your help! I ended up changing what I originally set out to do.
Thank you the message box tells me what cell I need correctly. That's fantastic.
Sorry, novice here, having trouble selecting that cell. Do you know what I'm doing wrong?
Dim myCell as 'I can't get anything to work'
myCell = ActiveDocument.Tables(2).C
myCell.range.Select