Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
chris
 
Posts: n/a
Default how do I insert a row based on a function result

I want to run a a IF statement to qualify a row of data, and them if the
condition is true, I want to insert a blank row below the current row where
the fomula resides. I could also rework the formula to allow for the
insertion of the blank row to be above the current row, as well. Either would
work.

Any assistance would be great!
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

Formulas can return values to the cell--they can't insert rows above (or below).

chris wrote:

I want to run a a IF statement to qualify a row of data, and them if the
condition is true, I want to insert a blank row below the current row where
the fomula resides. I could also rework the formula to allow for the
insertion of the blank row to be above the current row, as well. Either would
work.

Any assistance would be great!


--

Dave Peterson
  #3   Report Post  
chris
 
Posts: n/a
Default



"Dave Peterson" wrote:

Formulas can return values to the cell--they can't insert rows above (or below).

chris wrote:

I want to run a a IF statement to qualify a row of data, and them if the
condition is true, I want to insert a blank row below the current row where
the fomula resides. I could also rework the formula to allow for the
insertion of the blank row to be above the current row, as well. Either would
work.

Any assistance would be great!


--

Dave Peterson

I understand. Then, is there a way to insert a blank row from a Macro.. one
that would look at a one consistent cell within a row to qualify the
insertion (ie...for any row where column A contains "X", then insert a row??

Thanks.
  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

Option Explicit
Sub testme()

Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = Worksheets("sheet1")
With wks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For iRow = LastRow To FirstRow Step -1
If LCase(.Cells(iRow, "A").Value) = LCase("x") Then
.Rows(iRow + 1).EntireRow.Insert
End If
Next iRow
End With

End Sub

Will insert a new row after if it finds an X in column A. (after that row).

chris wrote:

"Dave Peterson" wrote:

Formulas can return values to the cell--they can't insert rows above (or below).

chris wrote:

I want to run a a IF statement to qualify a row of data, and them if the
condition is true, I want to insert a blank row below the current row where
the fomula resides. I could also rework the formula to allow for the
insertion of the blank row to be above the current row, as well. Either would
work.

Any assistance would be great!


--

Dave Peterson

I understand. Then, is there a way to insert a blank row from a Macro.. one
that would look at a one consistent cell within a row to qualify the
insertion (ie...for any row where column A contains "X", then insert a row??

Thanks.


--

Dave Peterson
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
How to Insert function right on text values e.g. 0180001640 Gary Brown Excel Worksheet Functions 0 May 18th 05 05:26 PM
Challenging Charting C TO Charts and Charting in Excel 0 January 17th 05 07:57 PM
How do I insert a row when using an if function BP Excel Worksheet Functions 1 December 27th 04 06:15 PM
I need a function to update sales/expenses based on previous tota. Christine C Excel Worksheet Functions 2 December 20th 04 06:49 PM
Is there a formula to spell out a number in excel? Sha-nay-nay Excel Worksheet Functions 2 December 18th 04 10:25 PM


All times are GMT +1. The time now is 12:48 PM.

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"