+ Reply to Thread
Results 1 to 2 of 2

Need vba to copy a set of columns and paste them back.

  1. #1
    Forum Contributor
    Join Date
    08-17-2010
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    127

    Need vba to copy a set of columns and paste them back.

    I have columns B, D , E , X etc (more than one usually)

    I need a trigger to copy their contents and paste it on top of them (yes you understood correctly you copy B column and paste it back into B column). By a method that excel detects so it triggers its automatic re-calculation of depending cells function.
    The triggering of this can be whatever is convenient for you. I can dedicate a cell that says "on"/"off". I don't need it to loop - Just once upon entry/switch.

    I need this because I use another vba function that does not detect changes on the content it references.

    in case you want to tackle the source:

    Please Login or Register  to view this content.
    Its used like this
    =StrOffset("namedrange 3 namedrange 1 namedrange 5",1)

    Bernie Deitrick suggested i put it inside a regular function like =IF(ISBLANK($TT$1),StrOffset("namedrange 3 namedrange 1 namedrange 5",1),"re-check")
    Which normally does the trick but crashes when the cell containing the above mentioned formula is referenced from another file via link cell (you copy this cell and "paste link" it in another excel file). Although it only crashed when you press "UPDATE" at the "This workbook contains links to external sources.... do you want to update, not update or get help" prompt. Otherwise it works normally.

    I've provided both so you can pick your preferred approach.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need vba to copy a set of columns and paste them back.

    Try adding this with your DIMs at the top of your function:

    Application.Volatile
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copy cell from sheet2 and paste it back on same row of sheet1.
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-13-2013, 12:32 PM
  2. Automate copy and paste and copy and paste back to excel
    By Bmw318be in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2013, 05:42 AM
  3. Automate copy and paste and copy and paste back to excel
    By Bmw318be in forum Access Tables & Databases
    Replies: 0
    Last Post: 02-23-2013, 05:42 AM
  4. Replies: 6
    Last Post: 03-18-2011, 10:16 AM
  5. 2 Macro's: only vertical copy/paste action and copy-paste 14 columns to the right.
    By vdongen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2010, 10:34 AM

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