Array to next empty cell

Lee Rabbit

New Member
Joined
Apr 30, 2020
Messages
43
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
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
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
 
Upvote 0

Forum statistics

Threads
1,214,962
Messages
6,122,482
Members
449,088
Latest member
Melvetica

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top