Results 1 to 9 of 9

Copy/Pasting Macro Function

Threaded View

  1. #2
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2019
    Posts
    163

    Smile Re: Copy/Pasting Macro Function

    Hello, I have added macros to your worksheet to do this.
    1) Open your file & SaveAs to NEW TEST file. Open my attachment.
    2) Go to VB Editor. Double-click on the Sheet1 Module of my attachment. In the Code window, you will see new code (two procedures: Worksheet_Change and Update_Model_Value).
    3) Swipe over all of this text with your mouse (highlite EVERYTHING in blue, top to bottom). Copy to PC buffer (Ctrl+C).
    4) In VB Editor, DOUBLE-Click on Sheet1 of your NEW TEST file. The code window here should be blank. Plant cursor in code window and paste clipboard here (Ctrl+V).
    5) Save file.
    6) Now you need to build NINE (9) different RANGE NAMES in your TEST file as follows:
    6a) Go to F4 (sheet1), then type "Model_Cell" (w/o quotes) in Range Name field and hit enter.
    6b) Select cell AB6-AB21, sheet1. Type "MinData_Source" in Range Name field, enter.
    6c) Select cell AC6-AC21, sheet1. Type "MaxData_Source" in Range Name field, enter.
    6d) Select cell E86-E101, sheet1098. Type "MinData_Trgt1098" in Range Name field, enter.
    6e) Select cell E151-E166, sheet1098. Type "MaxData_Trgt1098" in Range Name field, enter.
    6f & 6g) Ditto for sheet 1190 typing "..._Trgt1190"
    6h & 6i) Ditto for sheet 1220 typing "..._Trgt1220"
    7) Save file again. It should work for you at this point.
    8) This macro will execute automatically whenever you change value in F4 of sheet1. Alternatively, you could assign a Shortcut Key to the Macro (such as C+S+M) to drive the "copy" macro. But with the Worksheet_Change macro, you don't have to do this, as it will automatically see change and drive "copy" macro for you.
    9) Study code over & test out on TEST file. Make sure it does what you want. Change accordingly. Holler back if you get stomped on anything.
    ... Regards, sauerj
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1