how do you add a row of data like in a database

M

mabz

I am trying to add a row of data at the bottom of a named table using a
userform and VBA code.

I was unable to do this and it's driving me round the u bend!

PLEASE can any one help me before i go mad:(
 
P

pikus

nextRow = ActiveSheet.UsedRange.Row + _
ActiveSheet.UsedRange.Rows.Count
ActiveSheet.Cells(nextRow, 1).Value = NewColumn1Value
ActiveSheet.Cells(nextRow, 2).Value = NewColumn2Value

Does this answer your question? - Pikus
 
M

mabz

THANKS FOR THE CODE

but how do i add data from a text box on a userform to the end of
table.

~AS in you type in data in a form that pops up(Userform1)
~You click a button(called Add record)
~New data is added to the end of the tabl
 
N

N E Body

Hi

I am using

Sheets("Data").Select
Sheets("Data").Range("A65536").End(xlUp).Offset(1, 0).Range("A1").Activate

to locate the next empty row then

LogEntry.TextBox1.Text = ActiveCell.Offset(0, 1).Value
LogEntry.ComboBox1.Value = ActiveCell.Offset(0, 3).Value
LogEntry.ComboBox2.Value = ActiveCell.Offset(0, 4).Value
LogEntry.ComboBox3.Value = ActiveCell.Offset(0, 5).Value
LogEntry.ComboBox4.Value = ActiveCell.Offset(0, 6).Value
LogEntry.ComboBox5.Value = ActiveCell.Offset(0, 7).Value
LogEntry.ComboBox6.Value = ActiveCell.Offset(0, 8).Value
LogEntry.ComboBox7.Value = ActiveCell.Offset(0, 9).Value
LogEntry.TextBox3.Text = ActiveCell.Offset(0, 10).Value
LogEntry.TextBox4.Text = ActiveCell.Offset(0, 11).Value
LogEntry.TextBox5.Text = ActiveCell.Offset(0, 12).Value
LogEntry.TextBox7.Text = ActiveCell.Offset(0, 14).Value

where LogEntry is the name of the userform

HTH

Kenny
 
M

mabz

Thank you sooo much!!!!!!!!!!!!!!!!!!!

Now I can create colourful foems to impress every on
 
Top