PC Review


Reply
Thread Tools Rate Thread

Copy & paste special

 
 
pkeegs
Guest
Posts: n/a
 
      17th Aug 2009
I have the following section of code copied from another macro. The only
difference to the macro I have copied is the "ActiveCell.Offset(0,76).Select"
code. The Macro finds the correct cell but then stops at the PasteSpecial.
"CopyEvaluate" is a 4 cell range being copied into a location in another
sheet "Database". Has anyone got any thoughts as to why the Macro will not
paste when it works perfectly in the original macro?

Range("CopyEvaluate").Select
Selection.Copy
Sheets("Database").Select

Range("FormNumber").Select
Do Until ActiveCell = Range("B2").Value
ActiveCell.Offset(1, 0).Select
Loop

ActiveCell.Offset(0, 76).Select

Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      17th Aug 2009
Not sure what the problem was, but this minor modification cured it.

Sub fdk()
Range("A1:d1").Select
Selection.Copy
Sheets("Sheet2").Select

Range("B3").Select
Do Until ActiveCell = Range("B2").Value
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(0, 76).PasteSpecial
Paste:=xlPasteValuesAndNumberFormats _
, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End Sub

I suggest you learn to write your code without using the Select method. It
is much more effficient.

"pkeegs" <(E-Mail Removed)> wrote in message
news:F4366D87-BD8F-40FE-BCCA-(E-Mail Removed)...
>I have the following section of code copied from another macro. The only
> difference to the macro I have copied is the
> "ActiveCell.Offset(0,76).Select"
> code. The Macro finds the correct cell but then stops at the PasteSpecial.
> "CopyEvaluate" is a 4 cell range being copied into a location in another
> sheet "Database". Has anyone got any thoughts as to why the Macro will not
> paste when it works perfectly in the original macro?
>
> Range("CopyEvaluate").Select
> Selection.Copy
> Sheets("Database").Select
>
> Range("FormNumber").Select
> Do Until ActiveCell = Range("B2").Value
> ActiveCell.Offset(1, 0).Select
> Loop
>
> ActiveCell.Offset(0, 76).Select
>
> Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
> Operation:= _
> xlNone, SkipBlanks:=False, Transpose:=False



 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      17th Aug 2009
Sorry, should have gone back to your original code. Try this.

Range("CopyEvaluate").Select
Selection.Copy
Sheets("Database").Select

Range("FormNumber").Select
Do Until ActiveCell = Range("B2").Value
ActiveCell.Offset(1, 0).Select
Loop

ActiveCell.Offset(0, 76).PasteSpecial
Paste:=xlPasteValuesAndNumberFormats _
, Operation:=xlNone, SkipBlanks:=False, Transpose:=False


"pkeegs" <(E-Mail Removed)> wrote in message
news:F4366D87-BD8F-40FE-BCCA-(E-Mail Removed)...
>I have the following section of code copied from another macro. The only
> difference to the macro I have copied is the
> "ActiveCell.Offset(0,76).Select"
> code. The Macro finds the correct cell but then stops at the PasteSpecial.
> "CopyEvaluate" is a 4 cell range being copied into a location in another
> sheet "Database". Has anyone got any thoughts as to why the Macro will not
> paste when it works perfectly in the original macro?
>
> Range("CopyEvaluate").Select
> Selection.Copy
> Sheets("Database").Select
>
> Range("FormNumber").Select
> Do Until ActiveCell = Range("B2").Value
> ActiveCell.Offset(1, 0).Select
> Loop
>
> ActiveCell.Offset(0, 76).Select
>
> Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
> Operation:= _
> xlNone, SkipBlanks:=False, Transpose:=False



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't Copy and Paste or Paste Special between Excel Workbooks =?Utf-8?B?d2xsZWU=?= Microsoft Excel Misc 7 2 Days Ago 07:00 AM
Special Copy, Paste Special macro usmc-r70 Microsoft Excel Programming 3 2nd Jul 2009 08:12 AM
HELP - Excel 2003 cut, copy, paste and paste special problems Carrie Microsoft Excel Crashes 2 9th Dec 2008 06:36 PM
Automating copy/paste/paste special when row references change Carl LaFong Microsoft Excel Programming 4 8th Oct 2007 06:10 AM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Microsoft Excel Programming 3 7th Aug 2004 09:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:08 AM.