|
-
Nov 21st, 2011, 11:24 AM
#1
Thread Starter
New Member
-
Nov 21st, 2011, 11:41 AM
#2
Re: Create new column based on two other columns
Welcome to VBForums 
put that in a module.
Code:
Public Sub SummValues()
'Summ the values of two adjacent cells in each row and put the result into the next column
Dim MyRow As Long
'change the Sheet by number or name at your needs!
With ThisWorkbook.Sheets(1)
For Each c In .Range("A:A")
MyRow = c.Row
'The result will be put in Column 3 (i.e "C") change at your needs!
.Cells(MyRow, 3).Value = .Cells(MyRow, 29).Value + c.Value
Next c
End With
End Sub
You will notice that this code runs for some seconds. that is because there is no check when the end. You could for example end when the first empty cell is found in column A (or whichever you need).
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Nov 21st, 2011, 12:21 PM
#3
Thread Starter
New Member
Re: Create new column based on two other columns
That did it!
Thank you so much!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|