+ Reply to Thread
Results 1 to 4 of 4

Code verification (ie - simplify)

  1. #1
    Registered User
    Join Date
    10-21-2011
    Location
    South Carolina
    MS-Off Ver
    Excel 2010
    Posts
    22

    Code verification (ie - simplify)

    Hi,

    Can someone verify this code of mine so as to:

    1 - Simplify it so that I need not to repeat this for all the twelve months of the year

    2 - Copy and insert from Worksheet "Sheet1" to sheet "Mai", "Juin" and subsequent months in between rows B6 and before the last non empty row of all these month sheets

    Please Login or Register  to view this content.
    Any help would be appreciated.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Code verification (ie - simplify)

    What is selected at the start of the run?
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    419

    Re: Code verification (ie - simplify)

    I'm not entirely sure what you intend to do. Your 'Selection.Insert' lines, while seemingly associated with the month sheets actually inserts rows on Sheet1 (actually, as xladept pointed out, who knows what might be selected), as that is what is selected. As a rule, you should avoid selecting anything in VBA as it is rarely necessary, and it really slows things down.

    As I said, I'm not clear on what you are trying to do, but I hope the below code makes sense to you, and you can modify it to suit you if it doesn't quite do what you want. It goes through every sheet in the workbook, and sets the specified range in each sheet (offset by three rows) equal to that range in Sheet1.

    Please Login or Register  to view this content.
    Last edited by mgs73; 03-11-2017 at 06:05 PM.

  4. #4
    Registered User
    Join Date
    10-21-2011
    Location
    South Carolina
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: Code verification (ie - simplify)

    msg73

    Thank you for your response. I have evolved from my original post to the following code where I am using an array now.
    However I am still having issues. One problem I have is that I want to copy from Sheet1 the data that is located in column B3 to the last non empty cell of the column and paste it into the "Mai", "Juin", "Bilan" in between row B6 and the last non empty row of all these monthly worksheets.
    The second issue is that the last row of the monthly sheets contain formulas. I want to insert a new row above the last row of all these sheets. In this new row I need to copy the format and formulas above the newly inserted row and then paste this into the new row.

    I would included my workbook but it is too large for an upload even if I simplify it. If I can send it to you or make it accessible via Dropbox or another similar tool, I believe that this would help both you and I in understanding and explaining these issues.
    Below is the code:

    Please Login or Register  to view this content.

+ 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] simplify vba code
    By wyldjokre69 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2014, 10:01 AM
  2. [SOLVED] Simplify VBA Code
    By Sky188 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-28-2012, 02:31 PM
  3. [SOLVED] How can I simplify this code?
    By etuckram in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-26-2012, 05:04 AM
  4. hi can anyone simplify this old bit of code
    By khalid79m in forum Excel General
    Replies: 3
    Last Post: 12-28-2006, 01:04 PM
  5. [SOLVED] Simplify Code
    By Soniya in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-09-2006, 01:59 PM
  6. Post Code UK Structure Verification
    By jacky Kenna in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2006, 05:00 PM
  7. Simplify this code
    By Scott in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2006, 12:00 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