copy to next empty row

finch22

New Member
Joined
Sep 16, 2009
Messages
2
Hi,

I'll get straight to the point. I've got 2 rows: Date and Timer Value.
When I click the save button (see code below) it saves todays date and the value from a label in cell B2.

How do I get it so when the save button is pressed it copies to the next empty row each time? I'm guessing some sort of loop is needed?

Code:
Private Sub BtnSave_Click()
Dim dToday As String
dToday = Format(Date, "dd-mmm-yy")

Range("A2").Value = dToday
Range("B2").Value = TimerValue
    End Sub

appreciate any help.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hello and welcome to MrExcel.

Try

Code:
Range("A" & Rows.Count).End(xlUp).Offset(1).Value = dToday
Range("B" & Rows.Count).End(xlUp).Offset(1).Value = TimerValue
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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