Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting every nth through every nth row in a column Chris Excel Discussion (Misc queries) 1 July 9th 06 09:23 AM
Deleting nth row or column tarunpathria Excel Discussion (Misc queries) 1 February 15th 06 10:36 AM
Deleting a column reena Excel Discussion (Misc queries) 4 February 15th 06 06:45 AM
Deleting cells in a column ref a different column Daminc[_23_] Excel Programming 8 December 23rd 05 05:04 PM
Deleting a row by a column value DKY[_17_] Excel Programming 2 October 8th 04 01:33 AM


All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"