+ Reply to Thread
Results 1 to 5 of 5

Macro Line Insert

  1. #1
    Frantic Excel-er
    Guest

    Macro Line Insert

    I was wondering if it is possible to insert a line without a direct cell
    reference.
    This is exactly what I am trying to do...

    I have import files that have many different lines...(each one is unique).
    I wrote a macro to go thru the many tedious steps, except I am stuck on the
    line insertion part....I do a data sort for column "C", and then I do a find
    for "X" (which is a separation point). What I want to happen is for the
    macro to find "X" and insert a line above it, regardless of which row "X" is
    on. Is there a way to do that?

    Thanks!!!

  2. #2
    Bernie Deitrick
    Guest

    Re: Macro Line Insert

    Frantic,

    Columns("C:C").Find(What:="X", _
    LookIn:=xlValues, LookAt:=xlWhole).EntireRow.Insert

    HTH,
    Bernie
    MS Excel MVP


    "Frantic Excel-er" <FranticExceler@discussions.microsoft.com> wrote in
    message news:E5869D7C-32FE-4594-B360-0D6361B1054B@microsoft.com...
    > I was wondering if it is possible to insert a line without a direct cell
    > reference.
    > This is exactly what I am trying to do...
    >
    > I have import files that have many different lines...(each one is unique).
    > I wrote a macro to go thru the many tedious steps, except I am stuck on

    the
    > line insertion part....I do a data sort for column "C", and then I do a

    find
    > for "X" (which is a separation point). What I want to happen is for the
    > macro to find "X" and insert a line above it, regardless of which row "X"

    is
    > on. Is there a way to do that?
    >
    > Thanks!!!




  3. #3
    Frantic Excel-er
    Guest

    Re: Macro Line Insert

    Thanks Bernie....

    One more Q - I played with this and got it to work before I got your reply,
    but I did nt add the "look in" string...is that important since I want to
    find an X within an account number????

    "Bernie Deitrick" wrote:

    > Frantic,
    >
    > Columns("C:C").Find(What:="X", _
    > LookIn:=xlValues, LookAt:=xlWhole).EntireRow.Insert
    >
    > HTH,
    > Bernie
    > MS Excel MVP
    >
    >
    > "Frantic Excel-er" <FranticExceler@discussions.microsoft.com> wrote in
    > message news:E5869D7C-32FE-4594-B360-0D6361B1054B@microsoft.com...
    > > I was wondering if it is possible to insert a line without a direct cell
    > > reference.
    > > This is exactly what I am trying to do...
    > >
    > > I have import files that have many different lines...(each one is unique).
    > > I wrote a macro to go thru the many tedious steps, except I am stuck on

    > the
    > > line insertion part....I do a data sort for column "C", and then I do a

    > find
    > > for "X" (which is a separation point). What I want to happen is for the
    > > macro to find "X" and insert a line above it, regardless of which row "X"

    > is
    > > on. Is there a way to do that?
    > >
    > > Thanks!!!

    >
    >
    >


  4. #4
    Bernie Deitrick
    Guest

    Re: Macro Line Insert

    Frantic,

    The lookin isn't really that important unless you want to ignore values (the
    results of formulas) and look at formulas themselves. Just don't use the
    LookAt:=xlWhole - change that to xlPart instead.

    HTH,
    Bernie
    MS Excel MVP


    "Frantic Excel-er" <FranticExceler@discussions.microsoft.com> wrote in
    message news:88009B81-CC78-46CE-A3EA-58CA84D0C6B7@microsoft.com...
    > Thanks Bernie....
    >
    > One more Q - I played with this and got it to work before I got your

    reply,
    > but I did nt add the "look in" string...is that important since I want to
    > find an X within an account number????
    >
    > "Bernie Deitrick" wrote:
    >
    > > Frantic,
    > >
    > > Columns("C:C").Find(What:="X", _
    > > LookIn:=xlValues, LookAt:=xlWhole).EntireRow.Insert
    > >
    > > HTH,
    > > Bernie
    > > MS Excel MVP
    > >
    > >
    > > "Frantic Excel-er" <FranticExceler@discussions.microsoft.com> wrote in
    > > message news:E5869D7C-32FE-4594-B360-0D6361B1054B@microsoft.com...
    > > > I was wondering if it is possible to insert a line without a direct

    cell
    > > > reference.
    > > > This is exactly what I am trying to do...
    > > >
    > > > I have import files that have many different lines...(each one is

    unique).
    > > > I wrote a macro to go thru the many tedious steps, except I am stuck

    on
    > > the
    > > > line insertion part....I do a data sort for column "C", and then I do

    a
    > > find
    > > > for "X" (which is a separation point). What I want to happen is for

    the
    > > > macro to find "X" and insert a line above it, regardless of which row

    "X"
    > > is
    > > > on. Is there a way to do that?
    > > >
    > > > Thanks!!!

    > >
    > >
    > >




  5. #5
    Mr. T.
    Guest

    Re: Macro Line Insert

    I know this is an old thread, but maybe you can assisst.

    I have a list of data and I would like to insert a row after a change in
    data in column A.

    Sample data

    A B

    State Code State


    1 Alabama Total


    Hence, I would like to create a macro insert a row when "xx state" changes!


    Thanks,

    Larry T
    "Bernie Deitrick" wrote:

    > Frantic,
    >
    > Columns("C:C").Find(What:="X", _
    > LookIn:=xlValues, LookAt:=xlWhole).EntireRow.Insert
    >
    > HTH,
    > Bernie
    > MS Excel MVP
    >
    >
    > "Frantic Excel-er" <FranticExceler@discussions.microsoft.com> wrote in
    > message news:E5869D7C-32FE-4594-B360-0D6361B1054B@microsoft.com...
    > > I was wondering if it is possible to insert a line without a direct cell
    > > reference.
    > > This is exactly what I am trying to do...
    > >
    > > I have import files that have many different lines...(each one is unique).
    > > I wrote a macro to go thru the many tedious steps, except I am stuck on

    > the
    > > line insertion part....I do a data sort for column "C", and then I do a

    > find
    > > for "X" (which is a separation point). What I want to happen is for the
    > > macro to find "X" and insert a line above it, regardless of which row "X"

    > is
    > > on. Is there a way to do that?
    > >
    > > Thanks!!!

    >
    >
    >


+ 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