LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default worksheet_change help

I have a macro that I want to apply to a specific worksheet. So that when I
go to the worksheet and change any cell, the sheet will automatically call
the macro.

I have R4R5Reset already in a module and know I have to go to the specific
sheet to do some private sub worksheet_????. I just don't know how to get to
call it everytime I change any cell on the sheet.

Option Explicit

Sub R4R5Reset()

'Define Variables
Dim InPutOne, InPutTwo, InPutThree As Double
Dim OutPutOne, OutPutTwo As Range
Dim Input3 As Range
Dim first As Boolean
Dim last As Boolean

'Set Variables
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"

'Different scenarios
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 first = False Then
InPutThree = 1
first = True
ElseIf InPutOne = 1 And InPutTwo = 0 Then
InPutThree = 0
End If

'Results
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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet_Change ram Excel Programming 8 January 5th 06 11:13 PM
Worksheet_change Andrew haycock Excel Programming 2 September 3rd 03 05:32 PM
worksheet_change vs. calculate, and worksheet_change not running Tom Ogilvy Excel Programming 1 July 14th 03 02:51 AM
worksheet_change vs. calculate, and worksheet_change not running Ross[_5_] Excel Programming 0 July 13th 03 04:27 PM


All times are GMT +1. The time now is 12:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"