View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dennis Dennis is offline
external usenet poster
 
Posts: 59
Default VBA to -0- an amount during a Copy/Paste of a range of cells

2003

Row A B C
1 11 13 1000
2 12 12 3333
3 13 24 2222
4 14 32 4444

The Range being Copy/Paste is "C1:C4"
Using the table above, how do I make the amount Col "C" = 0 if the
value in Col "A" and Col "B" are equal?

Therefore, the Copy/Paste of "C1:C4" becomes:

Row A B C
1 11 13 1000
2 12 12 0
3 13 24 2222
4 14 32 4444

The challenge, as I see it, is what VBA code can I use to evaluate the
array as a whole and zero the amounts as defined above.

I realize that I can do a "Do While - Loop" on the worksheet range
after the Paste but that is slower and possibly not the smartest way to
accomplish the task.

The lines of code that I am using follow:

'Copies range from "Sheet1" to "Sheet2"
MyRngToCopy.Offset(0, 5).Resize(, 1).Copy
Sheets("Sheet2").Range("D" & CopyToRngRows).PasteSpecial
Paste:=xlPasteValues

TIA EagleOne