View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Mark Ivey Mark Ivey is offline
external usenet poster
 
Posts: 120
Default Macro to Enter text

Outstanding method to streamline this code Rick...

I bow to the master...


"Rick Rothstein (MVP - VB)" wrote in
message ...
Following through using the technique from my previous post...

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, _
ByVal Target As Range, Cancel As Boolean)
Cancel = True
If Not Intersect(Range("A1:A10"), ActiveCell) Is Nothing Then _
If InStr("X", ActiveCell.Value) Then _
ActiveCell.Value = Chr(88 - Asc(ActiveCell.Value & Chr(0)))
End Sub

Rick


"Mark Ivey" wrote in message
...
And if you want more range control... give this one a try...

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, _
ByVal Target As Range, Cancel As Boolean)

If Selection.Row <= 10 Then
If Selection.Column = 1 Then
If ActiveCell.Value = "X" Then
ActiveCell.Value = ""
ElseIf ActiveCell.Value < "X" Then
If ActiveCell.Value < "" Then
Exit Sub
ElseIf ActiveCell.Value = "" Then
ActiveCell.Value = "X"
End If
Else
End If
End If
End If

End Sub




"Mark Ivey" wrote in message
...
Try this in ThisWorkbook



Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, _
ByVal Target As Range, Cancel As Boolean)

If ActiveCell.Value = "X" Then
ActiveCell.Value = ""
ElseIf ActiveCell.Value < "X" Then
If ActiveCell.Value < "" Then
Exit Sub
ElseIf ActiveCell.Value = "" Then
ActiveCell.Value = "X"
End If
Else
End If

End Sub








"rpick60" wrote in message
...
I have a worksheet that users will have to insert X into cells for
items to order.
I would like a function that if the cell is blank then add "X" but if
their is "X" in then remove it to a blank.

It is like a toggle on or off.

Any ideas

Thanks