Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default How do I automatically insert a blank row between sets of data?

I have information I copy from one database from another. The rows all start
with the chassis number. There could be 30 chassis in that week. I want to
have excell automatically insert a blank row between each chassis
information. There are sometimes only one row of data related to that
chassis and sometimes 20 or 30, never a set number. Can this be done?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default How do I automatically insert a blank row between sets of data?

"Automatic" would need VBA.

Here is a macro that inserts a row at every change in chassis number in column A

Sub InsertRow_At_Change()
Dim i As Long
With Application
.Calculation = xlManual
.ScreenUpdating = False
End With
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i - 1, 1) < Cells(i, 1) Then _
Cells(i, 1).Resize(1, 1).EntireRow.Insert
Next i
With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
End With
End Sub


Gord Dibben MS Excel MVP

On Thu, 17 Aug 2006 07:16:03 -0700, usdivers
wrote:

I have information I copy from one database from another. The rows all start
with the chassis number. There could be 30 chassis in that week. I want to
have excell automatically insert a blank row between each chassis
information. There are sometimes only one row of data related to that
chassis and sometimes 20 or 30, never a set number. Can this be done?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default How do I automatically insert a blank row between sets of data

Gord, Thank you SO MUCH. That worked perfectly!

"Gord Dibben" wrote:

"Automatic" would need VBA.

Here is a macro that inserts a row at every change in chassis number in column A

Sub InsertRow_At_Change()
Dim i As Long
With Application
.Calculation = xlManual
.ScreenUpdating = False
End With
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i - 1, 1) < Cells(i, 1) Then _
Cells(i, 1).Resize(1, 1).EntireRow.Insert
Next i
With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
End With
End Sub


Gord Dibben MS Excel MVP

On Thu, 17 Aug 2006 07:16:03 -0700, usdivers
wrote:

I have information I copy from one database from another. The rows all start
with the chassis number. There could be 30 chassis in that week. I want to
have excell automatically insert a blank row between each chassis
information. There are sometimes only one row of data related to that
chassis and sometimes 20 or 30, never a set number. Can this be done?



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default How do I automatically insert a blank row between sets of data

Glad to help.

Thanks for the feedback.


Gord

On Thu, 17 Aug 2006 17:14:01 -0700, usdivers
wrote:

Gord, Thank you SO MUCH. That worked perfectly!

"Gord Dibben" wrote:

"Automatic" would need VBA.

Here is a macro that inserts a row at every change in chassis number in column A

Sub InsertRow_At_Change()
Dim i As Long
With Application
.Calculation = xlManual
.ScreenUpdating = False
End With
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i - 1, 1) < Cells(i, 1) Then _
Cells(i, 1).Resize(1, 1).EntireRow.Insert
Next i
With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
End With
End Sub


Gord Dibben MS Excel MVP

On Thu, 17 Aug 2006 07:16:03 -0700, usdivers
wrote:

I have information I copy from one database from another. The rows all start
with the chassis number. There could be 30 chassis in that week. I want to
have excell automatically insert a blank row between each chassis
information. There are sometimes only one row of data related to that
chassis and sometimes 20 or 30, never a set number. Can this be done?




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default How do I automatically insert a blank row between sets of data

Hi Gord Dibben,

How about inserting two rows? Please help

Regards
Giovs


"Gord Dibben" wrote:

Glad to help.

Thanks for the feedback.


Gord

On Thu, 17 Aug 2006 17:14:01 -0700, usdivers
wrote:

Gord, Thank you SO MUCH. That worked perfectly!

"Gord Dibben" wrote:

"Automatic" would need VBA.

Here is a macro that inserts a row at every change in chassis number in column A

Sub InsertRow_At_Change()
Dim i As Long
With Application
.Calculation = xlManual
.ScreenUpdating = False
End With
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i - 1, 1) < Cells(i, 1) Then _
Cells(i, 1).Resize(1, 1).EntireRow.Insert
Next i
With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
End With
End Sub


Gord Dibben MS Excel MVP

On Thu, 17 Aug 2006 07:16:03 -0700, usdivers
wrote:

I have information I copy from one database from another. The rows all start
with the chassis number. There could be 30 chassis in that week. I want to
have excell automatically insert a blank row between each chassis
information. There are sometimes only one row of data related to that
chassis and sometimes 20 or 30, never a set number. Can this be done?






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default How do I automatically insert a blank row between sets of data

Try changing
Cells(i, 1).Resize(1, 1).EntireRow.Insert
to
Cells(i, 1).Resize(2, 1).EntireRow.Insert

Giovs wrote:

Hi Gord Dibben,

How about inserting two rows? Please help

Regards
Giovs

"Gord Dibben" wrote:

Glad to help.

Thanks for the feedback.


Gord

On Thu, 17 Aug 2006 17:14:01 -0700, usdivers
wrote:

Gord, Thank you SO MUCH. That worked perfectly!

"Gord Dibben" wrote:

"Automatic" would need VBA.

Here is a macro that inserts a row at every change in chassis number in column A

Sub InsertRow_At_Change()
Dim i As Long
With Application
.Calculation = xlManual
.ScreenUpdating = False
End With
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i - 1, 1) < Cells(i, 1) Then _
Cells(i, 1).Resize(1, 1).EntireRow.Insert
Next i
With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
End With
End Sub


Gord Dibben MS Excel MVP

On Thu, 17 Aug 2006 07:16:03 -0700, usdivers
wrote:

I have information I copy from one database from another. The rows all start
with the chassis number. There could be 30 chassis in that week. I want to
have excell automatically insert a blank row between each chassis
information. There are sometimes only one row of data related to that
chassis and sometimes 20 or 30, never a set number. Can this be done?





--

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
From several workbooks onto one excel worksheet steve Excel Discussion (Misc queries) 6 December 1st 05 08:03 AM
Help PLEASE! Not sure what answer is: Match? Index? Other? baz Excel Worksheet Functions 7 September 3rd 05 03:47 PM
How to match sort and lineup 2 sets of data VTALABRAT Excel Worksheet Functions 0 June 23rd 05 12:26 AM
insert data into chart Sybil227 Charts and Charting in Excel 2 April 12th 05 02:29 PM
Import Data: on insert, shift data down and not right Raminhos Excel Discussion (Misc queries) 1 February 17th 05 02:08 PM


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