Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting every nth through every nth row in a column | Excel Discussion (Misc queries) | |||
Deleting nth row or column | Excel Discussion (Misc queries) | |||
Deleting a column | Excel Discussion (Misc queries) | |||
Deleting cells in a column ref a different column | Excel Programming | |||
Deleting a row by a column value | Excel Programming |