If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Inserting Line in MS Excel 2003 through formula/ macro

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-17-07, 16:50
prashantnayar prashantnayar is offline
Registered User
 
Join Date: Sep 2007
Posts: 3
Red face 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.
Reply With Quote
  #2 (permalink)  
Old 09-17-07, 19:55
shades shades is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 09-17-07, 22:30
prashantnayar prashantnayar is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 09-18-07, 08:49
shades shades is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 09-18-07, 09:40
prashantnayar prashantnayar is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On