ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   select contents of cell (https://www.excelbanter.com/excel-programming/338578-select-contents-cell.html)

dlh[_3_]

select contents of cell
 

This ought to be very easy, but browsing the help files doesn't help:

I'm writing my own data validation routine. If the validation fails,
want the contents of the failed cell to be selected (so the user ca
begin typing new content for the cell without touching the mouse). Al
I know how to do is:

MyCell.Select

which selects the cell, but not its contents.

-dl

--
dl
-----------------------------------------------------------------------
dlh's Profile: http://www.excelforum.com/member.php...fo&userid=2611
View this thread: http://www.excelforum.com/showthread.php?threadid=39994


Tom Ogilvy

select contents of cell
 
Sub ValidationFailed(mycell As Range)
mycell.Select
SendKeys "{F2}{Home}+{End}"
End Sub

Sub TestCode()
Dim mycell As Range
Set mycell = Range("F3")
ValidationFailed mycell
End Sub

--
Regards,
Tom Ogilvy

"dlh" wrote in message
...

This ought to be very easy, but browsing the help files doesn't help:

I'm writing my own data validation routine. If the validation fails, I
want the contents of the failed cell to be selected (so the user can
begin typing new content for the cell without touching the mouse). All
I know how to do is:

MyCell.Select

which selects the cell, but not its contents.

-dlh


--
dlh
------------------------------------------------------------------------
dlh's Profile:

http://www.excelforum.com/member.php...o&userid=26113
View this thread: http://www.excelforum.com/showthread...hreadid=399940




dlh[_4_]

select contents of cell
 

SendKeys ... the concept I was missing. Thank you very much

--
dl
-----------------------------------------------------------------------
dlh's Profile: http://www.excelforum.com/member.php...fo&userid=2611
View this thread: http://www.excelforum.com/showthread.php?threadid=39994



All times are GMT +1. The time now is 09:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com