MatthewSeven
New Member
- Joined
- Mar 5, 2014
- Messages
- 7
Hey Guys!
I have the following code to add data to a particular column but it looks for an empty row rather than looking for an empty column cell which is resulting in data being overwritten. Been searching for ages and get the same code for just empty row, Any fixes guys?
Private Sub CommandButton1_Click()
Dim LastRow As Long
LastRow = Worksheets("Totals").Range("A65536").End(xlUp).Row + 1
Worksheets("Totals").Range("DW" & LastRow).Value = TextBox1.Text
Worksheets("Totals").Range("DX" & LastRow).Value = Date
Worksheets("Totals").Range("DY" & LastRow).Value = Format(Now, "HH:mm")
MsgBox "Added"
Unload Me
End Sub
Thanks, Matthew
I have the following code to add data to a particular column but it looks for an empty row rather than looking for an empty column cell which is resulting in data being overwritten. Been searching for ages and get the same code for just empty row, Any fixes guys?
Private Sub CommandButton1_Click()
Dim LastRow As Long
LastRow = Worksheets("Totals").Range("A65536").End(xlUp).Row + 1
Worksheets("Totals").Range("DW" & LastRow).Value = TextBox1.Text
Worksheets("Totals").Range("DX" & LastRow).Value = Date
Worksheets("Totals").Range("DY" & LastRow).Value = Format(Now, "HH:mm")
MsgBox "Added"
Unload Me
End Sub
Thanks, Matthew