ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HOW DO I ADD ONE COLUMN TO A SECOND WITHOUT DELETING THAT VALUE (https://www.excelbanter.com/excel-programming/420080-how-do-i-add-one-column-second-without-deleting-value.html)

nick

HOW DO I ADD ONE COLUMN TO A SECOND WITHOUT DELETING THAT VALUE
 
How do I add one column to a second without deleting the original value in
the second column. i am trying to get an accumulative value. The value in
the first column will change constantly.

Thanks,

Nick

JP[_4_]

HOW DO I ADD ONE COLUMN TO A SECOND WITHOUT DELETING THAT VALUE
 
Can't you use a third column and just add the two values together, or
am I missing something?

Column 3 = Column 1 + Column 2

ex:

A1 contains the number 1
B1 contains the number 2
C1 contains "=A1+B1"

HTH,
JP


On Nov 15, 10:45 am, Nick wrote:
How do I add one column to a second without deleting the original value in
the second column. i am trying to get an accumulative value. The value in
the first column will change constantly.

Thanks,

Nick



Barb Reinhardt

HOW DO I ADD ONE COLUMN TO A SECOND WITHOUT DELETING THAT VALUE
 
You'll need a worksheet_change event on the worksheet of interest. Right
click on the worksheet tab to View Code. Select the worksheet you are
changing and paste this in for the code

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myChangeRange As Range
Dim myChangeRangeCol As Long
Dim myAccumRangeCol As Long

myChangeRangeCol = 2 'Column B, Change as needed
myAccumRangeCol = 3 'Column C

Set myChangeRange = Me.Columns(myChangeRangeCol)

If Target.Count 1 Then Exit Sub

If Not Intersect(myChangeRange, Target) Is Nothing Then
Target.Offset(0, myAccumRangeCol - myChangeRangeCol).Value = _
Target.Offset(0, myAccumRangeCol - myChangeRangeCol).Value + _
Target.Value
End If

End Sub

--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Nick" wrote:

How do I add one column to a second without deleting the original value in
the second column. i am trying to get an accumulative value. The value in
the first column will change constantly.

Thanks,

Nick


Barb Reinhardt

HOW DO I ADD ONE COLUMN TO A SECOND WITHOUT DELETING THAT VALUE
 
It works in 2003 as well. Do you have your speakers on? What references do
you have set for your project?
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Nick" wrote:

How do I add one column to a second without deleting the original value in
the second column. i am trying to get an accumulative value. The value in
the first column will change constantly.

Thanks,

Nick


Gary Keramidas

HOW DO I ADD ONE COLUMN TO A SECOND WITHOUT DELETING THAT VALUE
 
i have no idea what you're trying to do, but here's a guess.

Sub test()
Dim ws As Worksheet
Dim lastrow As Long
Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "A").End(xlUp).Row
Dim i As Long

For i = 1 To lastrow
With ws
.Range("B" & i).Formula = "=" & .Range("B" & i).Value & "+ A" & i
End With
Next
End Sub


--


Gary

"Nick" wrote in message
...
How do I add one column to a second without deleting the original value in
the second column. i am trying to get an accumulative value. The value in
the first column will change constantly.

Thanks,

Nick




Barb Reinhardt

HOW DO I ADD ONE COLUMN TO A SECOND WITHOUT DELETING THAT VALU
 
This reply was posted to the wrong thread. oops!

Barb Reinhardt

"Barb Reinhardt" wrote:

It works in 2003 as well. Do you have your speakers on? What references do
you have set for your project?
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Nick" wrote:

How do I add one column to a second without deleting the original value in
the second column. i am trying to get an accumulative value. The value in
the first column will change constantly.

Thanks,

Nick



All times are GMT +1. The time now is 06:31 AM.

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