Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default VBA help for simulation

Need help to simulate an electronic card in excel.

A certain card has 2 inputs and 1 output.

Inputs:
C8, C9

Outputs:
C10

At the start, C8 and C9 both have a value of 0. C10 has a value of 0 and
"UNLATCHED" appears in F10.

C9 (has an external link) changes from 0 to 1 when I change some data. This
causes C10 to have a value of 1. "UNLATCHED" disappears from F10 and
"LATCHED" appears in D10.

I change C9 back to 0 when I change the data again. C10 still has a value of
1. "LATCHED" remains in D10.

I created a button that changes C8 from 0 to 1 and vice versa. When I press
the button, C8 becomes a 1.
I want C10 to become 0. "LATCHED" disappears from F10 and "UNLATCHED"
appears in F10. After 2 seconds, C8 becomes a 0 and we are back at square 1.

Maybe this will help:

C8 C9 C10 D10 F10
1. 0 0 0 0
"UNLATCHED"
2. 0 1 1 "LATCHED"
3. 0 0 1 "LATCHED"
4. 1 0 0
"UNLATCHED"
5. back to square 1

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default VBA help for simulation

Private Sub CommandButton1_Click()
'Declare your Variables
Dim InputOne, InPutTwo, InPutThree As Range
Dim OutPutOne, OutPutTwo As Range

'Tell Excel what your Variables are
Set InputOne = Range("C8")
Set InPutTwo = Range("C9")
Set InPutThree = Range("C10")
Set OutPutOne = Range("F10")
Set OutPutTwo = Range("D10")

'Tell Excel What to do in each "if"
If InputOne.Value = "0" And InPutTwo.Value = "0" Then
InPutThree.Value = "0"
ElseIf InputOne.Value = "0" And InPutTwo.Value = "1" Then
InPutThree = "1"
ElseIf InputOne.Value = "0" And InPutTwo.Value = "0" Then
InPutThree.Value = "1"
ElseIf InputOne.Value = "1" And InPutTwo.Value = "0" Then
InPutThree.Value = "0"
End If

If InPutThree.Value = "0" Then
OutPutOne.Value = "UNLATCHED"
OutPutTwo.Value = ""
ElseIf InPutThree.Value = "1" Then
OutPutTwo.Value = "LATCHED"
OutPutOne.Value = ""
End If
End Sub


"Mike B." wrote:

Need help to simulate an electronic card in excel.

A certain card has 2 inputs and 1 output.

Inputs:
C8, C9

Outputs:
C10

At the start, C8 and C9 both have a value of 0. C10 has a value of 0 and
"UNLATCHED" appears in F10.

C9 (has an external link) changes from 0 to 1 when I change some data. This
causes C10 to have a value of 1. "UNLATCHED" disappears from F10 and
"LATCHED" appears in D10.

I change C9 back to 0 when I change the data again. C10 still has a value of
1. "LATCHED" remains in D10.

I created a button that changes C8 from 0 to 1 and vice versa. When I press
the button, C8 becomes a 1.
I want C10 to become 0. "LATCHED" disappears from F10 and "UNLATCHED"
appears in F10. After 2 seconds, C8 becomes a 0 and we are back at square 1.

Maybe this will help:

C8 C9 C10 D10 F10
1. 0 0 0 0
"UNLATCHED"
2. 0 1 1 "LATCHED"
3. 0 0 1 "LATCHED"
4. 1 0 0
"UNLATCHED"
5. back to square 1

Thanks in advance

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
Simulation Sherif Excel Programming 14 December 28th 07 09:56 AM
I need to set up a simulation Janet Excel Programming 2 July 6th 07 07:04 PM
I need to set up a simulation Janet Setting up and Configuration of Excel 1 July 6th 07 06:13 PM
How can I speed up my VBA simulation?? Andy Excel Programming 4 December 3rd 05 05:16 PM
Car assign simulation L. Chung Excel Worksheet Functions 6 April 12th 05 03:11 PM


All times are GMT +1. The time now is 03:01 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"