Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

UserForm code to delete selected personnel I would like to code a UserForm to de

ID: 3562685 • Letter: U

Question

UserForm code to delete selected personnel

I would like to code a UserForm to delete the row of data relating to a selected individual and move rows up in ALL worksheets.

I need the UserForm to have a dropdown box which picks up any names added to the list. When a name has been selected in the dropdown box, Initals and age are added to 2 other text boxes on the form. When the "Delete" commandbutton is pressed a message confirming "information will be deleted Press OK".

My workbook consist of a Nominal list containing Name, Initial and Age. The rest of the work book is 12 worksheets (Jan, Feb, Mar etc) with Name, Initial and age, and then columns D to AH contain letters relating to an activity.

Thanks in advance:-),

Explanation / Answer

Knowing now, from the other question about this workbook, that your list of names begins on row 4 and not row 2, we need to adjust the Refers To formula for NamesList

Assuming that there is some text in both A1 and A2, even if only a single dot/period and always will be something in them then that formula would become:

=OFFSET(Nominal!$A$4,0,0,COUNTA(Nominal!$A:$A)-3,1)

If cells A1 and A2 are currently truly empty and will always remain empty, then the formula just needs to change to refer to the proper base cell, $A:$4 vs $A$2:

=OFFSET(Nominal!$A$4,0,0,COUNTA(Nominal!$A:$A)-1,1)

But for it to work properly, both A1 and A2 should either always be empty or always contain something.

Well, I guess there is another option: either A1 or A2 always has something in it while the other cell always has nothing in it, in which case it becomes:

=OFFSET(Nominal!$A$4,0,0,COUNTA(Nominal!$A:$A)-2,1)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote