View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
rpick60 rpick60 is offline
external usenet poster
 
Posts: 33
Default Macro to Enter text

Sorry Guys but I got it, I did not see it was for the workbook. I
changed to the worksheet and got to work. Thanks for the help


On Dec 14, 12:01 am, rpick60 wrote:
Thanks for the help guys but I cannot get it to work. I do have
another program run on this worksheet and it is a
Private Sub Worksheet_SelectionChange(ByVal Target As Range).

I have not added it to this sub but to a new one under this one.
I also need it to work in cells C8:L8
What am I missing

On Dec 13, 11:21 pm, "Rick Rothstein \(MVP - VB\)"



wrote:
More an "interesting alternative" as opposed to an outstanding betterment, I
would think.


Rick


"Mark Ivey" wrote in message


...


Outstanding method to streamline this code Rick...


I bow to the master...


"Rick Rothstein (MVP - VB)" wrote in
.. .
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- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -