Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro to enter blank row

Similar to "SubTotal" without the subtotal, i'm looking to create a macro
that will search for a change in column info and insert a blank row between.
Can you help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Macro to enter blank row

Hi Missy,

Try:

'============
Public Sub Tester001()
Dim rng As Range
Dim rcell As Range
Dim i As Long
Const col As String = "A" '<<==== CHANGE

For i = Selection.Rows.Count To 2 Step -1
With Cells(i, col)
If .Value < .Offset(-1).Value Then
.EntireRow.Insert
End If
End With
Next i
End Sub
'<<============

Change the value of the col constant to reflect your column of interest.

---
Regards,
Norman



"MissyLovesExcel" wrote in
message ...
Similar to "SubTotal" without the subtotal, i'm looking to create a macro
that will search for a change in column info and insert a blank row
between.
Can you help?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Macro to enter blank row

Hi Missy,

Deleting two redundant variables and taking the opportunity to toggle Screen
updates, try:

'============
Public Sub Tester001()
Dim i As Long
Const col As String = "A" '<<==== CHANGE

Application.ScreenUpdating = False

For i = Selection.Rows.Count To 2 Step -1
With Cells(i, col)
If .Value < .Offset(-1).Value Then
.EntireRow.Insert
End If
End With
Next i

Application.ScreenUpdating = True

End Sub
'<<============


---
Regards,
Norman


"Norman Jones" wrote in message
...
Hi Missy,

Try:

'============
Public Sub Tester001()
Dim rng As Range
Dim rcell As Range
Dim i As Long
Const col As String = "A" '<<==== CHANGE

For i = Selection.Rows.Count To 2 Step -1
With Cells(i, col)
If .Value < .Offset(-1).Value Then
.EntireRow.Insert
End If
End With
Next i
End Sub
'<<============

Change the value of the col constant to reflect your column of interest.

---
Regards,
Norman



"MissyLovesExcel" wrote in
message ...
Similar to "SubTotal" without the subtotal, i'm looking to create a macro
that will search for a change in column info and insert a blank row
between.
Can you help?





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
Macro to select cells in column enter data then press enter NP New Users to Excel 1 February 20th 08 04:21 PM
If cell a1 not blank enter 8.26 in A2 ???? How pano Excel Worksheet Functions 4 February 12th 07 08:57 PM
HOW TO ENTER A BLANK IN WORKSHEET FUNCTION T2 Excel Worksheet Functions 2 December 15th 06 04:37 AM
Run formula only if values are enter, otherwise leave blank Karen Excel Worksheet Functions 2 August 26th 06 12:49 AM
enter numbers in blank cells bill gras Excel Worksheet Functions 2 September 21st 05 01:17 PM


All times are GMT +1. The time now is 05:42 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"