How to make a form to fill the first blank row instead of the first row of a table.

Copper Contributor

In Excel forms, when selecting the forms options and entering the data, the data is entered in the first row of the table. I need the form to enter the data from the blank row of the table so that the data may be entered in the same table after multiple application closures.

7 Replies
I would define a variable called "last row" which gives me the number of the last row.

You can use this line of code to do that:

lastRow = Cells(Rows.Count, 1).End(xlUp).Row

now to add data from the userform you can use something like this

Cells(lastRow, 1) = me.nameoftheelementfromyouruserform

If this doesn't help, please upload the excel file so I can take a look at it



@PascalKTeam 

Thank you for your reply. I have attached the worksheet of the form and attached the trouble that I am having. 

The vba code is not saved in this document but in E:\Work documents\OneDrive - Quest Pharmaceuticals Pvt. Ltd\Work documents\Performance appraisal and Operations management\Draft for the activities and task list-macro enabled.xlsm'!New_data_entry

First you sould include the code into your actual file.

Also I don't really understand the requirement that you mention in the file, sorry

@PascalKTeam 

Thank you for your quick response. I have attached the updated file. Hope you understand my requirement. I have only used a macro and not edited the code of the macro.

MS Excel 2020 version 14.0.4734.1000(32 bit)
I only now realised that you are using the excel standard dataform. Unfortunately, there is no way to change the behaviour of this form. In order to make it do what you require, we would need to set up a completely new inputform with VBA. Of course this could be done but it requires some skills and time...