VBA for copying and adding new cell value in every row

FLAWLESSKING

New Member
Joined
Nov 19, 2016
Messages
12
Hello Guys, i need to execute this simple thing...pls read below


A1 = 15


here a1 has cell value 15, so when I change it to 16, A2 should show number 15, when i change it to 17, A3 should show number 16,


means whenever i update the Cell Value A1, the new row records the previous value and posts the data one after another, something like this...


A1 = 15 (the number gets updated, and the previous number gets added below)
A2 = 15
A3 = 16
A4 = 17
A5 = 18

any help would be deeply appreciated, thanks a million.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Do the values always increment by 1

Or might you enter 300 in A1 then enter 647 in A1 and then enter 987 in A1
 
Upvote 0
Try this:
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  1/29/2019  2:33:51 AM  EST
If Target.Address = Range("A1").Address Then
If Target.CountLarge > 1 Then Exit Sub
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row + 1
Cells(Lastrow, 1).Value = Target.Value
End If
End Sub
 
Upvote 0
Try this:
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  1/29/2019  2:33:51 AM  EST
If Target.Address = Range("A1").Address Then
If Target.CountLarge > 1 Then Exit Sub
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row + 1
Cells(Lastrow, 1).Value = Target.Value
End If
End Sub

Thanks a Million sir, exactly what i was looking for, works like a charm!!
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,194
Members
452,616
Latest member
intern444

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