+ Reply to Thread
Results 1 to 5 of 5

Insert A Row

Hybrid View

  1. #1
    Mark Williams
    Guest

    Insert A Row

    Hi All,

    I am trying to write a macro that will insert a row above a blank row in a
    range I've named "PriorPTI". The blank row is the last row in a range that
    contains 12 rows. The range will grow as I insert more rows. I am not a
    programmer so any help will be greatly appreciated as I've spent two work
    days trying to figure this out (Yes: it is rocket science :-)).

    Regards,
    Mark


  2. #2
    Gary Keramidas
    Guest

    Re: Insert A Row

    this might be all you need.

    Option Explicit

    Dim lastrow As Long

    Sub insertrow()
    lastrow = Cells(Rows.Count, "A").End(xlUp).offset(1,0).Row
    Range("a" & lastrow).EntireRow.Insert


    End Sub


    --


    Gary


    "Mark Williams" <MarkWilliams@discussions.microsoft.com> wrote in message
    news:C7CA84BF-D7D4-4558-94AA-39E1292A87EE@microsoft.com...
    > Hi All,
    >
    > I am trying to write a macro that will insert a row above a blank row in a
    > range I've named "PriorPTI". The blank row is the last row in a range that
    > contains 12 rows. The range will grow as I insert more rows. I am not a
    > programmer so any help will be greatly appreciated as I've spent two work
    > days trying to figure this out (Yes: it is rocket science :-)).
    >
    > Regards,
    > Mark
    >




  3. #3
    Tom Ogilvy
    Guest

    Re: Insert A Row

    Dim rng as Range
    set rng = Range("PriorPTT")
    set rng = rng.rows(rng.rows.count)
    rng.EntireRow.Insert

    --
    Regards,
    Tom Ogilvy



    "Mark Williams" <MarkWilliams@discussions.microsoft.com> wrote in message
    news:C7CA84BF-D7D4-4558-94AA-39E1292A87EE@microsoft.com...
    > Hi All,
    >
    > I am trying to write a macro that will insert a row above a blank row in a
    > range I've named "PriorPTI". The blank row is the last row in a range that
    > contains 12 rows. The range will grow as I insert more rows. I am not a
    > programmer so any help will be greatly appreciated as I've spent two work
    > days trying to figure this out (Yes: it is rocket science :-)).
    >
    > Regards,
    > Mark
    >




  4. #4
    Mark Williams
    Guest

    Re: Insert A Row

    Tom/Gary Thanks for your responses. Tom I copied your macro right into vis.
    basic and received the following run time error: 1004 Method 'Range' of
    object'_Global' failed. I did add Sub insertrow() before the macro and End
    Sub at the end.

    Thanks for your help.
    Regards,
    Mark

    "Tom Ogilvy" wrote:

    > Dim rng as Range
    > set rng = Range("PriorPTT")
    > set rng = rng.rows(rng.rows.count)
    > rng.EntireRow.Insert
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    >
    > "Mark Williams" <MarkWilliams@discussions.microsoft.com> wrote in message
    > news:C7CA84BF-D7D4-4558-94AA-39E1292A87EE@microsoft.com...
    > > Hi All,
    > >
    > > I am trying to write a macro that will insert a row above a blank row in a
    > > range I've named "PriorPTI". The blank row is the last row in a range that
    > > contains 12 rows. The range will grow as I insert more rows. I am not a
    > > programmer so any help will be greatly appreciated as I've spent two work
    > > days trying to figure this out (Yes: it is rocket science :-)).
    > >
    > > Regards,
    > > Mark
    > >

    >
    >
    >


  5. #5
    Mark Williams
    Guest

    Re: Insert A Row

    Tom, Please ignore my previous post. The error was due to incorrect
    spelling. Thanks for your help.

    Gary, Thank you as well for your time. Its greatly appreciated.

    Regards,
    Mark

    "Tom Ogilvy" wrote:

    > Dim rng as Range
    > set rng = Range("PriorPTT")
    > set rng = rng.rows(rng.rows.count)
    > rng.EntireRow.Insert
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    >
    > "Mark Williams" <MarkWilliams@discussions.microsoft.com> wrote in message
    > news:C7CA84BF-D7D4-4558-94AA-39E1292A87EE@microsoft.com...
    > > Hi All,
    > >
    > > I am trying to write a macro that will insert a row above a blank row in a
    > > range I've named "PriorPTI". The blank row is the last row in a range that
    > > contains 12 rows. The range will grow as I insert more rows. I am not a
    > > programmer so any help will be greatly appreciated as I've spent two work
    > > days trying to figure this out (Yes: it is rocket science :-)).
    > >
    > > Regards,
    > > Mark
    > >

    >
    >
    >


+ 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