View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
minkokiss minkokiss is offline
external usenet poster
 
Posts: 7
Default Add values from two columns into third one in another workshee

On Apr 11, 10:08 pm, JLGWhiz
wrote:
That should be Do Until i = lr

"minkokiss" wrote:
On Apr 11, 1:46 pm, JLGWhiz wrote:
Maybe I just can't read good any more. I seem to see three different
descriptions of an objective. The illustration of data shows that values in
column A is added to the values in column B and the result is posted to
column C in a different sheet.


The code shows that each column in the active workbook is copied to Range
AV7 on a workbook named workbook. Since each iteration copies to the same
range, only the last iteration will survive.


You need to clearly state what you want to do with the data on the active
sheet and then define how you want it to be arranged on the destination
sheet. i.e. append each iteration vertically, or append each iteration
horizontally, etc. Leave blank line between iteration, don't leave blank
lines. If you can describe it, it can be built.


"minkokiss" wrote:
this is the code I will use to iterate through the data in one of the
columns. I need help to come up with the code for the second column
and then pasting in the third. Essentially what I am trying to do is:


Column A Column B Column C (another worksheet)
a e a + e
b h b + h
c l c + l
blank p blank + p
d m d + m


and so on


For i = 1 To lLastCol


If Cells(5, i).Value = SearchAcc Then
Cells(5, i).Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Copy
Workbooks("workbook").Sheets("worksheet").Range("$ AV
$7").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks
_
:=False, Transpose:=False


End If


Next i


Thank you in advance for any help


I apologize for the confusion. The situation is the following: I get a
monthly report from a cell phone company but the headers on this
report are not the same each month(God knows why) so what I am trying
to do is:


1) Find the first column by searching through the headers for a
particular string
2) Find the second column by doing the same
3) Go through each of the two columns row by row and sum the rows of A
and B and paste them into same row in C.
For example sum row 1 of column a with row 1 of column B and paste in
row 1 column C. Then do the same with all the rows with data in rows A
and B and paste into C.


Does that bring clarification to my issue or I got everybody more
confused?


Fist of all thank you so much for the help. I need to ask you some
questions and most this is because I was not clear in what I want
accomplished. Your suggested solution copies columns A and B to the
new worksheet and then adds the values together and pastes them into
the third. I want to only use the values from A and B without copying
them or moving them, add the values up and then paste in column C (all
this in the program) row by row. Also in the code you select the
entire column and my values are below the header row (which is a
locked row) and using the entire column method will select everything
including the header (I have used it before and had bad experience).
Could you tell me what needs modified under these circumstances? Thank
you for taking the time to educate newbies.

Minko