Jump to content
Sign in to follow this  
GaryChrist

[Help] _Excel_RangeCopyPaste - paste special is not working

Recommended Posts

Hi all, I want to copy Values from workbook A to workbook B. This is what I use:

$oRange3 = $oWorkbookUpdate.Worksheets(1).Range("Q3:AA3")
$oLastRow = $oWorkbookS.Worksheets(1).UsedRange.Rows.Count
_Excel_RangeCopyPaste($oWorkbookS.Worksheets(1),$oRange3, "A" & $oLastRow+1, Default, $xlPasteValuesAndNumberFormats)

But somehow the $xlPasteValuesAndNumberFormats is not working, I still get the formula pasted at workbook B, while what I want is the values only.

Anyone can help on this? 

Share this post


Link to post
Share on other sites

What is the value of @error and @extended after _Excel_RangeCopyPaste?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Your code looks good so far.
I'm on a business trip right now and will return on Friday. On Saturday I will leave for a two week vacation.  Hope I find some spare time to check before I'm off for vacation.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Solved already, I use RangeRead & RangeWrite:

$oCopy3 = _Excel_RangeRead ($oWorkbookUpdate,1,"Q3;S3:AA3")
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 1", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
$oLastRow = $oWorkbookS.Worksheets(1).UsedRange.Rows.Count
_Excel_RangeWrite ($oWorkbookS,1,$oCopy3,"A" & $oLastRow+1,True)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 1", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

But still, I wonder why RangeCopyPaste won't give me the values..

Share this post


Link to post
Share on other sites

Maybe because RangeCopyPaste only copy Formulas and not Values on Cells and in the other hand RangeRead do it in a different way, so maybe you should look inside the  RangeCopyPaste function and you can figure it out.

Kind Regards
Alien.

Share this post


Link to post
Share on other sites

As described in the help file: "If $vSourceRange and $vTargetRange are specified parameters $iPaste, $iOperation, $bSkipBlanks and $bTranspose are ignored"


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...