worksheet_change help
oh good! i'm glad it worked!
susan
On Jun 25, 11:22*am, Mike B. wrote:
Thank you very much. I tried your msgbox on an empty spreadsheet, but it
still wouldn't appear. I then saw your reset macro and I was able to get the
msgbox. So simply put: "application.enableevents = true" right under Private
Sub and it works very well.
"Susan" wrote:
i dunno........
i put this in an empty spreadsheet & entered a value in a random cell
& it worked.
=================
Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox "Hi there!"
End Sub
=================
you actually made a change (as opposed to just clicking on the cell)?
if so, i don't know why it wasn't triggered. *try running this little
sub separately......
sub reset()
application.screenupdating = true
application.enableevents = true
end sub
sometimes when you're playing with code you get out of a code while
enableevents is set to false & it doesn't get reset. *after you run
this little code (nothing visible will happen), try your change again.
susan
On Jun 25, 10:41 am, Mike B. wrote:
I right clicked the the specific sheet in the Project Explorer window.. I
clicked view code and pasted the following code into the specific sheet. When
I change InPutOne or InPutTwo, no action takes place and I don't get the
sheet to change.
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Declare your Variables
Dim InPutOne, InPutTwo, InPutThree As Double
Dim OutPutOne, OutPutTwo As Range
Dim Input3 As Range
Dim first As Boolean
Dim last As Boolean
'Tell Excel what your Variables are
InPutOne = Range("AA12").Value
InPutTwo = Range("C11").Value
Set OutPutOne = Range("Y6")
Set OutPutTwo = Range("X23")
Set Input3 = Range("S16")
'Booleans
first = OutPutOne.Value = "UNLATCH"
last = OutPutTwo.Value = "LATCH"
* 'Tell Excel What to do in each "if"
* * If InPutOne = 0 And InPutTwo = 0 And first Then
* * * InPutThree = 0
* * ElseIf InPutOne = 0 And InPutTwo = 1 Then
* * * InPutThree = 1
* * ElseIf InPutOne = 1 And InPutTwo = 1 Then
* * * InPutThree = 1
* * ElseIf InPutOne = 0 And InPutTwo = 0 And last Then
* * * InPutThree = 1
* * ElseIf InPutOne = 1 And InPutTwo = 0 Then
* * * InPutThree = 0
* * End If
* * If InPutThree = 0 Then
* * * OutPutOne.Value = "UNLATCH"
* * * OutPutTwo.Value = ""
* * * Input3.Value = 0
* * ElseIf InPutThree = 1 Then
* * * OutPutTwo.Value = "LATCH"
* * * OutPutOne.Value = ""
* * * Input3.Value = 1
* * End If
End Sub- Hide quoted text -
- Show quoted text -
|