Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2007
    Posts
    3

    Red face Unanswered: Inserting Line in MS Excel 2003 through formula/ macro

    Hi,

    Is there a way to insert a line in MS Excel through an "IF" statement? Or can it be done with the help of a macro subject to a certain value in a cell (e.g: cell a 44 has value "xxx", and for every instance of that value I want to insert a line)?? Please do let me know at the earliest. I'm using Excel 2003.

    If possible please mail me on prashantnayar666@gmail.com.

    Thanks very very much in advance

    PN.

  2. #2
    Join Date
    Oct 2003
    Posts
    1,091
    Howdy and welcome to the board.

    Not sure of your level of VBA, but in code it is relatively easy. You could use use either IF THEN clause or use Select Case with several cases based on i.e. Cells(3,5).Value = 44. If this isn't clear, post back.
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

  3. #3
    Join Date
    Sep 2007
    Posts
    3

    Smile

    Quote Originally Posted by shades
    Howdy and welcome to the board.

    Not sure of your level of VBA, but in code it is relatively easy. You could use use either IF THEN clause or use Select Case with several cases based on i.e. Cells(3,5).Value = 44. If this isn't clear, post back.
    Thanks for the reply buddy.
    My thing is I'm new to VB coding....I just use the 'record macro' function. I'm facing a problem where I'm trying to insert a line according to values in an adjacent cell.

    For example; My first column has data as follows:

    publication 1
    publication 1
    publication 1
    publication 2
    publication 2
    publication 2
    publication 2
    publication 3
    publication 3

    So what I need is that I need a line break between publications (i.e. whenever I come across a new publication in the column)......and I wanted to know how I could do that by way of an IF statement since I don't know how to insert a line by code.

    If that makes it any clearer please let me know.....or I can put up a printscreen too

    Thanks

  4. #4
    Join Date
    Oct 2003
    Posts
    1,091
    That helps, but it is slightly different than what you put in OP. In other words, the criteria changes with the change in Publication in column A. Correct?
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

  5. #5
    Join Date
    Sep 2007
    Posts
    3
    Yup....but what I did was insert another column, remove the duplicate instances by an "IF" statement, and then in a 3rd column did a check for empty cells. So now I'd need to add a new line for every time excel encounters the word "TRUE", and 2 lines it encounters "FALSE" in the third column. I've attached a screenshot too



    Btw thanks for your quick responses, really appreciate the help

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •