ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy the value to the next open cell when the original cell changes (https://www.excelbanter.com/excel-programming/414482-copy-value-next-open-cell-when-original-cell-changes.html)

[email protected]

Copy the value to the next open cell when the original cell changes
 
I have a Excel spreadsheet that is linked to another program and
displaying a value from the linked db in the first cell of the
spreadsheet. What I would like to do is capture the value of the first
cell as it changes and copy to the next available empty cell in the
row. Something like this example below.

Initial value shows:
Col1 Col2 Col3
53

when the value changes the first time do this:
Col1 Col2 Col3
54 53

when the value changes again do this:
Col1 Col2 Col3
55 53 54

And so on.....

Any help would be greatly appreciated.

Wigi

Copy the value to the next open cell when the original cell change
 
Something in this spirit:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Address = "$A$1" Then
Application.EnableEvents = False
Cells(1, Columns.Count).End(xlToLeft).Offset(, 1).Value = Target.Value
Application.EnableEvents = False
End If

End Sub



--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


" wrote:

I have a Excel spreadsheet that is linked to another program and
displaying a value from the linked db in the first cell of the
spreadsheet. What I would like to do is capture the value of the first
cell as it changes and copy to the next available empty cell in the
row. Something like this example below.

Initial value shows:
Col1 Col2 Col3
53

when the value changes the first time do this:
Col1 Col2 Col3
54 53

when the value changes again do this:
Col1 Col2 Col3
55 53 54

And so on.....

Any help would be greatly appreciated.



All times are GMT +1. The time now is 11:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com