Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Check for previous entry

I am making a user form that inputs information on a worksheet, it will
be making multiple entries for each row based on radio buttons on the
form, the question i have is, is it possible to check a range of cells
for a previous entry of the same value that the form is trying to put
in the cell? Basically, i'm making a time sheet input that will enter
the employee name in the A column then an in or out time (selected by
radio buttons) in either B for in or C for out. I want to first search
the previous entries of A for the employee to make sure i don't get two
lines of the same employee. The employee name is being set by a combo
box on the form. Any Suggestions?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Check for previous entry

Craig, Try something like this:

Private Sub CmdEnter_Click()

Dim CurRng As Range

For Each CurRng In Range("EmployeeNames")

If CurRng = CboNames Then
MsgBox "We Have an attempt at a duplicate entry in cell " _
& CurRng.Address
Exit For
End If
Next CurRng

End Sub

You can replace the MsgBox function with the code that you want to take
it's place. By the way CboNames is the ComboBox name and
Range("EmployeeNames") represents the area of the sheet where your
names reside (Column A I guess) just in case you didn't get that. Hope
that gets ya rollin... Mark

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Check for previous entry

Craig,
Something like this?
NameButton is a button on the form.
The TestForName sub can go in a standard module
or in the Form module.
Jim Cone
San Francisco, USA


'-----------------------------
Private Sub NameButton_Click()
TestForName
End Sub

Sub TestForName()
Dim strValue As String
strValue = UserForm1.ComboBox1.Value
If IsError(Application.Match(strValue, Range("A1:A100"), 0)) Then
MsgBox "Ok to use "
Else
MsgBox "Not ok to use "
End If
End Sub
'-------------------------


"Craig"
wrote in message
oups.com
I am making a user form that inputs information on a worksheet, it will
be making multiple entries for each row based on radio buttons on the
form, the question i have is, is it possible to check a range of cells
for a previous entry of the same value that the form is trying to put
in the cell? Basically, i'm making a time sheet input that will enter
the employee name in the A column then an in or out time (selected by
radio buttons) in either B for in or C for out. I want to first search
the previous entries of A for the employee to make sure i don't get two
lines of the same employee. The employee name is being set by a combo
box on the form. Any Suggestions?

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
repeat entry from previous column jdw Excel Worksheet Functions 1 January 30th 10 02:06 PM
Is there anything that will copy previous entry multiple times? stacey Excel Discussion (Misc queries) 2 December 18th 08 06:06 PM
check for previous entry MichaelCasper New Users to Excel 2 August 29th 08 11:36 PM
restricting entry into a cell based on entry to a previous cell newbie57 New Users to Excel 1 June 9th 08 05:43 PM
How to "repeat previous entry" ? fantasma Excel Worksheet Functions 9 December 10th 04 01:43 PM


All times are GMT +1. The time now is 02:13 AM.

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"