Array to next empty cell

Lee Rabbit

New Member
Joined
Apr 30, 2020
Messages
41
Office Version
  1. 2010
Platform
  1. Windows
Hi Guys/Gals,

Can you tell me the most efficient way to complete this task.

I have a user form with 2 text fields and I want to populate the next empty cell in a defined range (A1:A100)

As I populate the database I need the textbox 1 input into A1 cell and textbox 2 into B1 cell of a sheet named TEMPLATE

As I add new data, I want the next empty cells below to populate with the new data.

I am pretty competent with my understanding of arrays but this is giving me a bit of a headache as I am struggling with dynamic population

Thank you in advance, much appreciated.

Regards, Lee
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

cooper645

Well-known Member
Joined
Nov 16, 2013
Messages
622
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
I added 2 textboxes (1 & 2) to a sheet and a command button, then assigned this code to command button click

I'm sure you can amend it to suit your needs, if not, let me know what needs amending

VBA Code:
Private Sub CommandButton1_Click()
Dim LRow As Long

LRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1

Cells(LRow, 1) = TextBox1
Cells(LRow, 2) = TextBox2

TextBox1 = ""
TextBox2 = ""

End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,118,206
Messages
5,570,889
Members
412,345
Latest member
avelraza
Top