Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Copy & paste special

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Copy & paste special

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" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Copy & paste special

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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Special Copy, Paste Special macro usmc-r70 Excel Programming 3 July 2nd 09 08:12 AM
Automating copy/paste/paste special when row references change Carl LaFong Excel Programming 4 October 8th 07 06:10 AM
help w/ generic copy & paste/paste special routine DavidH[_2_] Excel Programming 5 January 23rd 06 03:58 AM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Excel Programming 3 August 7th 04 09:49 PM


All times are GMT +1. The time now is 01:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"