View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Why does this work?

My apologies, I did misread your intent. This is what I believe you are
doing.

With Sheets("Running total")
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
.Cells(LastRow, "B").Resize(1, 28).Copy .Cells(LastRow + 1, "B")
.Cells(LastRow, "B").Resize(1, 28).Copy
.Cells(LastRow, "B").PasteSpecial xlValues
End With

But is doesn't gain anything and may be worse because of the second copy -
and looking at bob's comment, I suspect he must have suggested the original
in an earlier thread.

--
Regards,
Tom Ogilvy


"Brad" wrote:

If I wanted to do this

1. I would have to change

.Cells(LastRow + 1, "B").PasteSpecial xlValues to
.Cells(LastRow, "B").PasteSpecial xlValues - to get rid of the formulas

and I would have to copy the equations to (LastRow + 1) before I do number 1

Correct?


"Tom Ogilvy" wrote:

You received good explanations. here is an approach that doesn't need the
resize multiple times.

With Sheets("Running total")
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
.Cells(LastRow, "B").Resize(1, 28).Copy
.Cells(LastRow + 1, "B").PasteSpecial xlValues
.Cells(LastRow + 1, "B").PasteSpecial xlFormats
End With

--
Regards,
Tom Ogilvy





"Brad" wrote:

This works correctly

With Sheets("Running total")
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
.Cells(LastRow, "B").Resize(1, 28).Copy .Cells(LastRow + 1, "B")
.Cells(LastRow, "B").Resize(1, 28).Value = .Cells(LastRow,
"B").Resize(1, 28).Value
End With

Why do I need the resize (1, 28) twice on the last line to change the
equations to values? But on the second line - I don't need it.

Confused - can someone shed some light on the subject. Or if there is a
better way to range value - please let me know.