PDA

View Full Version : Sleeper: Using Userforms



Sir Phoenix
09-15-2005, 04:43 PM
I have a userform. I have a few questions about it.

I currently have a textbox, and two comboboxes for people to enter data. When people have made an entry, I want...

IF the data in the textbox matches ANY record in column A, I want the new data to overwrite the old.
ELSE I want this data to populate cells A,B, and C of the first row (starting at 3 and going down) that doesn't already have a record.
After a record is updated/added, I want the information in A3:C(whatever number the last record is) to be sorted based on column A.

Also, I have another button that I want to search for an exact match of columns A,B,C and if it exists, delete the entire row.

Zack Barresse
09-15-2005, 08:05 PM
Hey Sir Phoenix!

Questions:

IF the data in the textbox matches ANY record in column A, I want the new data to overwrite the old.
If there is an exact match, can't you just leave it alone? Or is there other data you want written and/or checked?

What do the combobox's have to do with the data?

What object will hold the value to check your spreadsheet with?

Can you upload a sample file??

Sir Phoenix
09-15-2005, 08:40 PM
Hey Sir Phoenix!

Questions:

If there is an exact match, can't you just leave it alone? Or is there other data you want written and/or checked?

What do the combobox's have to do with the data?

What object will hold the value to check your spreadsheet with?

Can you upload a sample file??

If there's an exact match on the textbox (name field), the combo fields need to 'update' the info in column B and C.

Column A will hold the necessary data to match.

Crud. I had made a userform, and gotten half the code worked out, then the spreadsheet crashed and I lost everything. I can remember everything I figured out, though. I was posting snippits I was grabbing from the forums and the KB. Anyways, the form had 5 buttons.

Button1:

Looks through A3:A(end of records).
If match found, updates info with the stuff from the combo boxes (columns B & C)
If not found, new record made at end of list (new end of list) writing to column A B and C.

(I had gotten this to work kinda, but for some reason it kept on overwriting A250, reguardless of whether it was a match or not!)

After a name is updated/added, cells A3:C(last record) should be selected, and sorted in ascending order based on column B (shift-type) and column A (employee name) (I can figure out how to make it sort... just need the code to select A3: variable Crow.)

After this is done, it clears out the values in the textboxes and comboboxes. (I figured out how to do that part.)

2nd button finds an exact match from the textbox and both comboboxes, then deletes the entire row from the spreadsheet.

3rd button closes the userform. (figured this out! unload me!)

The bottom two buttons are left and right arrows.
If no record is selected,
left button (prev) will select the last record in the list. If a record is selected, it will select the one before the current one.
right button (next) will select the first record on the list. If a record is already selected it will selct the next record.

So I figured out 'some' of it... I'm attaching the spreadsheet. The only thing I'm working on currently is the employees tab at the end. A button will go there to load the userform. (I can probably figure that out.)

Thanks for any help you can provide! :P

Zack Barresse
09-16-2005, 06:39 AM
Alright, working on this. Got most of it done, but will be in meetings the first part of the morning. I'll post back again when I'm out.

Zack Barresse
09-16-2005, 09:17 AM
Which sheets are we talking about here? I'm a little lost as to what data you are trying to manipulate with your userform.

Sir Phoenix
09-16-2005, 12:32 PM
Which sheets are we talking about here? I'm a little lost as to what data you are trying to manipulate with your userform.

The last one for now. Employees, I think?

Oops! Not on there.

There was an additional "Employees" tab at the end. It had "Employee Name" in A2 and Schedule Type in B2, and and Static Type in C2.