Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
David B
 
Posts: n/a
Default Insert a row if there is a value in a column in the row above

I have a large spreadsheet (approx. 8500 rows) with four columns.

I would like to insert a new row below any row where there is a value
(entry) in row D.

It is as simple as that, but I can't figure out how to do it...

Thanks
  #2   Report Post  
Earl Kiosterud
 
Posts: n/a
Default

David,

This is a one-time thing. If you run it again, you'll get another empty row
after any cell in column D that isn't empty. Keep an extra copy of your
sheet, or don't save the file if it messes up.

Dim ColumnD As Range
Dim MyCell As Range

Set ColumnD = Intersect(Range("D:D"), ActiveSheet.UsedRange)
For Each MyCell In ColumnD
If MyCell.Value < "" Then ' is it empty?
MyCell.Offset(1, 0).EntireRow.Insert Shift:=xlShiftDown ' insert row
after
End If
Next MyCell
--
Earl Kiosterud
www.smokeylake.com/
-------------------------------------------

"David B" <David wrote in message
...
I have a large spreadsheet (approx. 8500 rows) with four columns.

I would like to insert a new row below any row where there is a value
(entry) in row D.

It is as simple as that, but I can't figure out how to do it...

Thanks



  #3   Report Post  
David B
 
Posts: n/a
Default

Worked like a charm Earl.

Thanks so much!

Bless you

"Earl Kiosterud" wrote:

David,

This is a one-time thing. If you run it again, you'll get another empty row
after any cell in column D that isn't empty. Keep an extra copy of your
sheet, or don't save the file if it messes up.

Dim ColumnD As Range
Dim MyCell As Range

Set ColumnD = Intersect(Range("D:D"), ActiveSheet.UsedRange)
For Each MyCell In ColumnD
If MyCell.Value < "" Then ' is it empty?
MyCell.Offset(1, 0).EntireRow.Insert Shift:=xlShiftDown ' insert row
after
End If
Next MyCell
--
Earl Kiosterud
www.smokeylake.com/
-------------------------------------------

"David B" <David wrote in message
...
I have a large spreadsheet (approx. 8500 rows) with four columns.

I would like to insert a new row below any row where there is a value
(entry) in row D.

It is as simple as that, but I can't figure out how to do it...

Thanks




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
Lookup Table Dilemma Karen Excel Worksheet Functions 2 June 10th 05 08:22 PM
how do i insert words into a column without erasing the words soccer5585 Excel Discussion (Misc queries) 0 June 8th 05 11:06 PM
How to group similar column titles together???? vrk1 Excel Discussion (Misc queries) 2 April 30th 05 12:17 AM
Lookup then Match and insert value from next column Tenacity Excel Worksheet Functions 3 March 4th 05 02:49 AM
Challenging Charting C TO Charts and Charting in Excel 0 January 17th 05 06:57 PM


All times are GMT +1. The time now is 03:20 PM.

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

About Us

"It's about Microsoft Excel"