Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 32
Default Insert a new row based upon an if/then command

I would like to insert a new blank row when there is a value in a certain
colum of our spreadsheet.

How can I insert the row automatically after the row where the condition is
satisfied.

for example.... =IF(a1=popcorn,yippie,"insert a blank row below a1...")

How the heck do I do that?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,089
Default Insert a new row based upon an if/then command

You can't ... unless you use VBA.

If you think about it, if you could do what you want, how would Excel know
when to stop inserting blank rows after the row that met the condition ?

If you run a macro to check the column(s) it can do whatever you want.

In your example, I'm not sure what the condition is that you want to test.
You are actually saying insert a blank line when A1 is not equal to
"popcorn"

Maybe you meant:

=IF(A1="popcorn","insert a blank row below a1...","yippie")

The code to check all cells in column A might look something like:

Sub test()
Dim i as Long
For i = Range("A65536").End(xlUp).Row To 1 Step -1
If Range("A" & i).Value = "popcorn" Then
Range("A" & i).Offset(1, 0).EntireRow.Insert
End If
Next
End Sub


Regards

Trevor


"David B" wrote in message
...
I would like to insert a new blank row when there is a value in a certain
colum of our spreadsheet.

How can I insert the row automatically after the row where the condition
is
satisfied.

for example.... =IF(a1=popcorn,yippie,"insert a blank row below a1...")

How the heck do I do that?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
'Insert' 'Object' command: I have 11 blank rows of objects at top normally pretty pc savvy... Excel Discussion (Misc queries) 0 November 4th 06 05:59 AM
Name command in Insert Menu Ahmad Wali Zahid Excel Discussion (Misc queries) 1 January 31st 06 08:37 AM
can i insert a print command in a worksheet? darin van houten Excel Discussion (Misc queries) 0 August 27th 05 10:19 PM
Can I insert roundup command into different formulas in excel? Margaret Excel Worksheet Functions 4 August 5th 05 12:22 PM
To set up a command that will insert a row, every fifth row? shanespop2b New Users to Excel 3 May 6th 05 04:32 PM


All times are GMT +1. The time now is 12:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"