+ Reply to Thread
Results 1 to 4 of 4

Copy Range with Offset Variable and Clear Data

  1. #1
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Copy Range with Offset Variable and Clear Data

    I'm working to create a macro that will "Shift" data up a number or rows/months based on what the user enter's into an input box. With some googling and slow progress, I was able to put together the below code and sample. And this does work. But as I continue to learn and expand on the code, is there a better approach to doing the same thing?

    The next step is to likely update the starting Month as well by the same 'period' the user defines.

    Think I'm getting better

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Copy Range with Offset Variable and Clear Data

    Perhaps can you explain the purpose of the macro to start at the real beginning: Customer needs
    - Battle without fear gives no glory - Just try

  3. #3
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Copy Range with Offset Variable and Clear Data

    The Sample is part of what is would be an audit workpaper that is updated every XX months. The workpaper should always be showing 24 months of history. So when the user revisits the client again in XX months, they can 'push' all the data upwards in preparing to enter the new months info.

    Eventually, I hope to expand on it where an approximate 100+ tables are updated in setting up for the revisit. Currently, we copy/paste and move the data manually each time for a revisit.

  4. #4
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Copy Range with Offset Variable and Clear Data

    I worked some more on this last night while flying home, and created an Array and For Loop that will now 'shift' the contents upwards for 2 divisions, and should be able to add additional divisions as needed.

    But I really want to learn and get better at coding VBA and still wondering if it can be improved upon, eliminate any unneeded code, etc.

    New Sample file attached and code below. Note: I will probably create separate code that changes the dates as they will link to a main input sheet. Still in the 'learning' phase for now.

    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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] Clear Range with variable
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2014, 07:47 AM
  2. Replies: 1
    Last Post: 06-21-2013, 04:05 AM
  3. .offset clear range issue
    By kieranbop in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-01-2012, 06:52 PM
  4. Linking dynamically allocated row offset to stacked column chart data range variable
    By amanagarwal in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-05-2011, 02:25 PM
  5. [SOLVED] Clear data range, and copy static value.
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-23-2005, 03:50 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