ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   auto type text onclick in a cell (https://www.excelbanter.com/excel-programming/304992-auto-type-text-onclick-cell.html)

nospam

auto type text onclick in a cell
 
Is it possible to let Excel auto type a text string when I click in a
cell? I looking for a macro the type an "OK" when I click in cell R16C3,
cell R18C3 or in R16C7.

Regards,
Jonas

William[_2_]

auto type text onclick in a cell
 
Hi

Try placing this code in the relevant worksheet module, NOT a general
module.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim r As Range
If Target.Count 1 Then Exit Sub
Set r = Sheets("Sheet1").Range("C16,C18,G16")
If Not Intersect(Target, r) Is Nothing Then Target = "OK"
End Sub


--
XL2002
Regards

William



"nospam" " wrote in message
...
| Is it possible to let Excel auto type a text string when I click in a
| cell? I looking for a macro the type an "OK" when I click in cell R16C3,
| cell R18C3 or in R16C7.
|
| Regards,
| Jonas



jst_se[_2_]

auto type text onclick in a cell
 
Thank you, William!
That works for me.

Regards,
Jonas

William wrote:

Hi

Try placing this code in the relevant worksheet module, NOT a general
module.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim r As Range
If Target.Count 1 Then Exit Sub
Set r = Sheets("Sheet1").Range("C16,C18,G16")
If Not Intersect(Target, r) Is Nothing Then Target = "OK"
End Sub




--
Reclaim Your Inbox!
http://www.mozilla.org/products/thunderbird/


All times are GMT +1. The time now is 03:34 PM.

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