+ Reply to Thread
Results 1 to 3 of 3

How to add rows and dates on them

  1. #1
    Registered User
    Join Date
    06-26-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    1

    How to add rows and dates on them

    I somehow cant seem to understand what is wrong with this code, i basically want to simply add rows and put dates on them,and the places where i want that is where there is an empty line under it. Dates are going to be simply the next month after the line above.

    Here is the code, i get the error of "incompatibility type".(bolded line)

    The lines after the blank line are not same type of format(they are not dates, its text or numbers, my guess is that somehow it is linked, because i have tested the sub on a different collumn and it works..

    I am not very good at programming, so there are probably a lot of non-logical coding, i dont mind at all if you make another code, but i still would like to know whats wrong with the code.. whatever you guys can do to help, i will appreciate.

    thanks a lot.

    Please Login or Register  to view this content.
    Last edited by Leith Ross; 06-26-2009 at 09:44 PM. Reason: Added Code Tags

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,645

    Re: How to add rows and dates on them

    Hi there,

    I think there was just a small typing error in your code, but it caused a big problem!

    The following code seems to work for me:

    Please Login or Register  to view this content.
    The highlighted line shows where the mistake occurred.

    You'll see that I included the statement Option Explicit at the top of the VBA module. This is something you should always do. Because I included it before I tried your code, it showed me immediately where the error was. Basically, specifying the option as Explicit requires all variables to be declared in your code, so it will immediately notice any items which have been mistyped as they will not have been declared.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: How to add rows and dates on them

    Hello Split4u ,

    Welocme to the Forum!

    To make your posts easier to read, copy, and edit please wrap your code. I did it for you this time. Here is how you can do it next time.

    How to wrap your Code
    1. Select all your code using the mouse.
    2. Click on the # icon on the toolbar in the Message window. This will automatically wrap the text you selected with the proper Code tags to create a Code Window in your post.

    3. You can also do this manually by placing the tags
    [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] at the end of the line.


    As a member, You have agreed to follow the forum posting rules. Please take so time to familiarize yourself with the Do's and Don'ts here in the Forum, just click on the link below...

    Forum Rules
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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