Copy paste without selecting sheet or range

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

Hi,

I have written a very short piece of code which only works when the correct
sheet is selected:

FinalRow = Worksheets("WeeklySummary").Range("B65536").End(xlUp).Row

Worksheets("WeeklySummary").Range("B" & FinalRow & ":z" & FinalRow -
52).Copy Destination:=Range("B" & FinalRow + 1)

However I would like this to work when I run the macro from a different
sheet ie sheet "WeeklySummary" isn't active.

I'm sure that I have to use the Dim Rng as Range syntax, but cannot quite
get it right.

Could someone please help

Many Thanks
 
Hi

FinalRow = Sheets("WeeklySummary").UsedRange.Rows.Count

Sheets("WeeklySummary").Range("B & FinalRow & ":Z" & FinalRow).Copy
Sheets("WeeklySummary").Range("B & (FinalRow+1) & ":Z" &
(FinalRow+1)).PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
 
Maybe

Sub sonic()
FinalRow = Worksheets("WeeklySummary").Range("B65536").End(xlUp).Row
Worksheets("WeeklySummary").Range("B" & FinalRow & ":z" & FinalRow - 52).Copy
Worksheets("WeeklySummary").Range("B" & FinalRow + 1).PasteSpecial
End Sub



Mike
 

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

Back
Top