More efficient copy/paste??

  • Thread starter Thread starter Celt
  • Start date Start date
C

Celt

TIA!!!

Is there a more efficient way to perform this copy paste? I know yo
should always avoid selecting if possible. I have tried a number o
things and had no success. Here is the snippet of code I want t
streamline:

If rngNHO Is Nothing Then GoTo skipNHO
Sheets("ALL").Select
rngNHO.Copy
Sheets("Contribs").Select
Cells(Range("A3").End(xlDown).Row + 1, "A").Select
ActiveSheet.Paste
skipNHO:

I have several snippets like this in my macro. Any help is greatl
appreciated!
 
If Not rngNHO Is Nothing Then
rngNHO.Copy _
Destination:=Worksheets("Contribs") _
.Range("A3").End(xlDown).Offset(1, 0)
End If

HTH
 
Set rngNHO = Sheets("All").Range("A1")
Cells(Range("A3").End(xlDown).Row + 1, "A").Select
rngNHO.Copy ActiveCell

This assumes that you are on the Sheet that you want to paste the data
into.

HTH

Die_Another_Day
 
Thanks guys!

Quick question Ardus...

With your code, if rngNHO is nothing...will that cause an error
 
if you don't set the rngNHO to some range then it is empty...

Die_Another_Day
 
for Ardus' code it should not because of the if not rngNHO = Nothing

HTH

Die_Another_Day
 

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