userform help

  • Thread starter Thread starter Dawna
  • Start date Start date
D

Dawna

I'm trying to insert data into the first empty cell. My code keeps
overwriting the last entry...could someone help me figure out where I've
messed up?

Thank you in advance
Dawna

Private Sub CommandButton2_Click()
Dim rRng As Range
Set rRng = Range("A" & Range("A" & Rows.Count).End(xlUp).Row)
With rRng.Offset(rRng.Count + 1, 0).Select

rRng.Offset(1, 1) = Me.TbDate
rRng.Offset(1, 3) = Me.cboname
rRng.Offset(1, 5) = Me.TbPO
rRng.Offset(1, 6) = Me.TbCustom
 
Private Sub CommandButton2_Click()
Dim rRng As Range

LastRow = Range("A" & Rows.Count).End(xlUp).Row
Newrow = LastRow + 1

Range("B" & Newrow) = Me.TbDate
Range("D" & Newrow) = Me.cboname
Range("F" & Newrow) = Me.TbPO
Range("G" & Newrow) = Me.TbCustom
 
Joel,
Thank you so much! works great

Joel said:
Private Sub CommandButton2_Click()
Dim rRng As Range

LastRow = Range("A" & Rows.Count).End(xlUp).Row
Newrow = LastRow + 1

Range("B" & Newrow) = Me.TbDate
Range("D" & Newrow) = Me.cboname
Range("F" & Newrow) = Me.TbPO
Range("G" & Newrow) = Me.TbCustom
 
Back
Top