![]() |
Dont want a button
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 |
Dont want a button
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 "Steve" wrote in message ... 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 |
Dont want a button
"Rick Rothstein \(MVP - VB\)" wrote
in : 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 "Steve" wrote in message ... 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 --- 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 |
All times are GMT +1. The time now is 03:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com