Dont want a button

S

Steve

Hiya all.
So far I have this

Private Sub SubmitSwipe_Click()

If Sheets("Introduction").Range("F13").Value = "" Then
DoErrorMsg("NoSwipe")
Else

Submitted = Sheets("Introduction").Range("F13").Value

DoSwipeCheck (Submitted)

End If
End Sub


But what I would like to do is instead of having a button to press that
does the above I would like it so once the cell F13 has had its value
entered it automatically executes the above code.
The reason for this is the value of F13 is done by a swipe card. Which
once its value is entered the swipe also creates either a newline or
"enter" on its own ... which I thought could be used instead of having
to press a button, if you know what i mean.


thx


---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 080114-0, 14/01/2008
Tested on: 14/01/2008 07:49:13
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com
 
R

Rick Rothstein \(MVP - VB\)

If I understand your code correctly (and if you haven't hidden too much from
us), you should be able to do what you want like this...

1) Right-click the tab for your Introduction sheet.

2) Select View Code from the popup menu that appears.

3) Copy/Paste the following code into the code window that appeared when you
did Step #2

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$F$13" Then
If Target.Value = "" Then
DoErrorMsg "NoSwipe"
Else
DoSwipeCheck Range("F13").Value
End If
End If
End Sub

4) Make sure the scopes of both DoErrorMsg and DoSwipeCheck are such that
they can be "seen" from the worksheet's code window (that means either put
them in the same code window as you pasted the above code in, or put them in
a Module and make sure they are declared as Public).

That should be it... give it a try and see if it works for you.

Rick
 
S

Steve

If I understand your code correctly (and if you haven't hidden too
much from us), you should be able to do what you want like this...

1) Right-click the tab for your Introduction sheet.

2) Select View Code from the popup menu that appears.

3) Copy/Paste the following code into the code window that appeared
when you did Step #2

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$F$13" Then
If Target.Value = "" Then
DoErrorMsg "NoSwipe"
Else
DoSwipeCheck Range("F13").Value
End If
End If
End Sub

4) Make sure the scopes of both DoErrorMsg and DoSwipeCheck are such
that they can be "seen" from the worksheet's code window (that means
either put them in the same code window as you pasted the above code
in, or put them in a Module and make sure they are declared as
Public).

That should be it... give it a try and see if it works for you.

Rick






---
avast! Antivirus: Inbound message clean.
Virus Database (VPS): 080114-1, 14/01/2008
Tested on: 14/01/2008 13:54:13
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com

Works like a dream mate!!

Thanks


---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 080114-1, 14/01/2008
Tested on: 14/01/2008 13:58:27
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Hidding buttons 3
Code to big! 3
Spin button 2
Transparent button 5
Command button 2
reset a cell 5
Auto insert 2
Autosaving 2

Top