+ Reply to Thread
Results 1 to 2 of 2

Better way to write this snippet of code?

Hybrid View

cooper1308 Better way to write this... 11-16-2009, 04:25 AM
shg Re: Better way to write this... 11-16-2009, 02:16 PM
  1. #1
    Registered User
    Join Date
    07-12-2009
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    49

    Better way to write this snippet of code?

     ActiveCell.offset(-1, 11).Range("A1:B10").Copy
        Sheets("Pairs Trading").Select
        ActiveCell.offset(3, 0).Range("A1").Select
        ActiveSheet.Paste Link:=True
        Sheets("Market Depth").Select
        ActiveCell.offset(-1, 18).Range("A1:A10").Copy
        Sheets("Pairs Trading").Select
        ActiveCell.offset(0, 3).Range("A1").Select
        ActiveSheet.Paste Link:=True
        Sheets("Market Depth").Select
        ActiveCell.offset(-1, 17).Range("A1:A10").Copy
        Sheets("Pairs Trading").Select
        ActiveCell.offset(0, 1).Range("A1").Select
        ActiveSheet.Paste Link:=True
        Sheets("Market Depth").Select
    Anyone able to chop this code down at all? Trying to remove the "select" from certain places but not to sure on the syntax

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Better way to write this snippet of code?

    The dependency on the active cell on each sheet (which is not a good thing) would make that hard.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

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