ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro to copy and paste between 2 workbooks (https://www.excelbanter.com/excel-programming/281249-macro-copy-paste-between-2-workbooks.html)

Gary B[_4_]

macro to copy and paste between 2 workbooks
 
I have a Lotus file with 2 macros that i would like to
convert to Excel

The purpose of these 2 macros is to copy data from one
Lotus file to another, but as the data range being copied
into contains formulas, a "fix" macro is run to correct
the formula.

It would be nice to simply use the Excel copy and paste
features, but as the destination is protected, I need to
programatically unprotect the sheet, complete the paste,
then reprotect the sheet.

1st one is a copy macro
{sheetunprotect}
{IF @RANGENAME(A:C232..A:C232)=A:L313}{L 61}{R 2}{SELECT-
RANGE-RELATIVE 59;0;0}{EDIT-COPY}{ESC}{sheetprotect}{QUIT}

2nd one is a paste macro
[sheetunprotect}
{IF @RANGENAME(A:C256..A:C256)=A:L313}{L 61}{R 2}{EDIT-
PASTE-SPECIAL ;"CELL-CONTENTS"}{FIX}{sheetprotect}{QUIT}

where fix is a macro to simply copy over imported
formulas with formulas contained in a "master formula row"

{ESC}/CA:D350~A:D4..A:D302~/CA:K350~A:K4..A:K302~/CA:M350~
A:M4..A:M302~/CA:P350~A:P4..A:P302~/CA:R350~A:R4..A:R302~/
CA:U350~A:U4..A:U302~/CA:W350~A:W4..A:W302~/CA:Z350~A:Z4..
A:Z302~/CA:AB350..AF350~A:AB4..A:AB302~/CA:AH350~A:AH4..A:
AH302~/CA:AM350~A:AM4..A:AM302~/CA:AO350~A:AO4..A:AO302~/C
A:BE350..BI350~A:BE4..A:BE302~/CA:A351..A:BJ351~A:A3~



All times are GMT +1. The time now is 02:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com