Adding Problem

R

RM270

Hi all. Column A is a list of names. Column B is a number. Several more
columns of text. Column E is a number. I want to add Column E to B. Then I
want to print the sheet. Then I want to clear Column E, but keep the results
in Column B. I need to do this so that I can keep adding numbers to column B.

A B E
Joe Smith 80 4
Bob Brown 84 4

After adding, it looks like this:
Joe Smith 84
Bob Brown 88

Several days later, I want to add more numbers to Column B
Joe Smith 84 4
Bob Brown 88 3

After adding, it looks like this:
Joe Smith 88
Bob Brown 91

Can I do this? If so, please help, I'm at a loss.
Thanks in advance for any help.
 
B

Bob Phillips

With Activesheet

LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 T LastRow

If IsNumeric(.Cells(i, "B").Value2) Then

.Cells(i, "B").Value2 = .Cells(i, "B").Value2 + .Cells(i,
"C").Value2
End If
Next i
 
D

Don Guillett

You could use a worksheet_change event macro in the sheet module

if target.column<>2 then exit sub
application.enableevents=false
target.value=target+target.offset(,3)
target.offset(,3)=""
application.enableevents=true
 
R

RM270

Bob, I'm getting an error when I put the code in. It doesn't like the For i =
1 T last row. It is giving me a complie error. Says an expects a "to" Any
suggestions?
Thanks
 
R

RM270

Bob, I'm getting an error when I put the code in. It doesn't like the For i=1
t Lastrow
It gives me a complie error, it is expecting a To statement. Any suggestions?

Also, my VBA is a little rusty. What exactly are you telling it to do?
Thanks
 
B

Bob Phillips

Sorry, I had a typo, and there was wrap-around which can give problems.

Try this

With Activesheet

LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To LastRow

If IsNumeric(.Cells(i, "B").Value2) Then

.Cells(i, "B").Value2 = .Cells(i, "B").Value2 _
+ .Cells(i, "C").Value2
.Cells(i, "C").Value2 = ""
End If
Next i
End With

All it does it loop through every row and add B & C up
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top