#1   Report Post  
Posted to microsoft.public.excel.misc
tom tom is offline
external usenet poster
 
Posts: 570
Default Insert Row

Working in Excel 2007, I have a column (B) that when the number changes I
want a macro to insert a row... Approx 16K rows that need to be evaluated.

Example Desired Result
2333 2333
2333 2333
2333 2333
2335
2335

TFTH,
Tom

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 427
Default Insert Row

By coincidence I have a utility macro I wrote to do just that. To use
it, go to the bottom of the list and after the last cell enter the
word "stop" (without quotes) in that cell. Then place the cell pointer
at the top of the list and run this code.

Sub InsertRow()
With Application
.Calculation = xlManual
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False

Dim A, B

Do Until ActiveCell.Value = "stop"
A = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
B = ActiveCell.Value

If A < B Then
Selection.EntireRow.Insert
ActiveCell.Offset(1, 0).Select
End If
Loop

With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False

Calculate
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
tom tom is offline
external usenet poster
 
Posts: 570
Default Insert Row

Dave,
Works like a charm!!! Thanks... Tom

"Dave O" wrote:

By coincidence I have a utility macro I wrote to do just that. To use
it, go to the bottom of the list and after the last cell enter the
word "stop" (without quotes) in that cell. Then place the cell pointer
at the top of the list and run this code.

Sub InsertRow()
With Application
.Calculation = xlManual
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False

Dim A, B

Do Until ActiveCell.Value = "stop"
A = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
B = ActiveCell.Value

If A < B Then
Selection.EntireRow.Insert
ActiveCell.Offset(1, 0).Select
End If
Loop

With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False

Calculate
End Sub


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
SQL Server -- Bulk Insert from Excel to SQL Server Madhan Excel Discussion (Misc queries) 0 December 12th 06 03:08 PM
Changing the Insert Row / Column Default Mr. Low Excel Discussion (Misc queries) 4 October 23rd 06 05:25 PM
Can I auto insert a worksheet when I insert a value in a cell. iainc Excel Worksheet Functions 0 April 27th 06 08:37 AM
insert picture BillGwyer Excel Discussion (Misc queries) 1 March 4th 05 06:37 PM
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 06:21 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"