Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 590
Default a latching function

If cell (A) = a predetermined value then cell (B) = x. A simple if
statement,but, I want cell (B) to act as a latch. Once cell (A) has
switched cell (B) to X I want cell (B) to stay in that condition even if the
value of cell (A) changes from the predetermined value. i.e. I want cell
(B) to behave like a latch, once it has been switched on it stays on
regardless. Can you help. Kind regards
--
KenH
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default a latching function

Ken,

One way is by utilising a 3rd cell that initially blank and the first time
cell (a) satisfies your pre-determined value this 'flag cell' is given a
value and vell (b) is set to x. Any subsequent changes to cell(a) will be
evaluated as false by the macro because the check cell now has a value.

In the macro below 1,1 is cell(a) 1,2 is the flag cell and 1,3 is cell(b)

Private Sub Worksheet_Change(ByVal Target As Range)
If Cells(1, 1).Value = 1 And Cells(1, 2).Value = "" Then
Cells(1, 2).Value = 1
Cells(1, 3) = "x"
End If

Mike
End Sub

"Ken" wrote:

If cell (A) = a predetermined value then cell (B) = x. A simple if
statement,but, I want cell (B) to act as a latch. Once cell (A) has
switched cell (B) to X I want cell (B) to stay in that condition even if the
value of cell (A) changes from the predetermined value. i.e. I want cell
(B) to behave like a latch, once it has been switched on it stays on
regardless. Can you help. Kind regards
--
KenH

  #3   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 590
Default a latching function

Thanks Mike. Sounds easy when your brain works, that where I fall down.

Thanks again and kind regards.
--
KenH


"Ken" wrote:

If cell (A) = a predetermined value then cell (B) = x. A simple if
statement,but, I want cell (B) to act as a latch. Once cell (A) has
switched cell (B) to X I want cell (B) to stay in that condition even if the
value of cell (A) changes from the predetermined value. i.e. I want cell
(B) to behave like a latch, once it has been switched on it stays on
regardless. Can you help. Kind regards
--
KenH

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default a latching function

Your welcome and thanks for the feedback.

"Ken" wrote:

Thanks Mike. Sounds easy when your brain works, that where I fall down.

Thanks again and kind regards.
--
KenH


"Ken" wrote:

If cell (A) = a predetermined value then cell (B) = x. A simple if
statement,but, I want cell (B) to act as a latch. Once cell (A) has
switched cell (B) to X I want cell (B) to stay in that condition even if the
value of cell (A) changes from the predetermined value. i.e. I want cell
(B) to behave like a latch, once it has been switched on it stays on
regardless. Can you help. Kind regards
--
KenH

Reply
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
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Excel - User Defined Function Error: This function takes no argume BruceInCalgary Excel Programming 3 August 23rd 06 08:53 PM
Need to open the Function Arguments window from VBA for a user defined function. [email protected] Excel Programming 0 June 20th 06 03:53 PM
Offset function with nested match function not finding host ss. MKunert Excel Worksheet Functions 1 March 21st 06 10:46 PM
Adding a custom function to the default excel function list DonutDel Excel Programming 3 November 21st 03 03:41 PM


All times are GMT +1. The time now is 01:42 AM.

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

About Us

"It's about Microsoft Excel"