Inserting Lines
|
Inserting Lines
Try this
Sub test() Application.ScreenUpdating = False Dim numRows As Integer Dim R As Long Dim Rng As Range numRows = 1 Set Rng = ActiveSheet.UsedRange For R = Rng.Rows.Count To 1 Step -23 Rng.Rows(R + 1).Resize(numRows).EntireRow.insert Next R Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "C" wrote in message ... IS there a way to program Excel to insert a new line. For example I need to have a new line instered every 23 lines in a spreadsheet I am working on. Your help would be greatly appreciated! Christie |
Inserting Lines
This will only work if your rows count is a multiple from 23
you can check that in the code also and make the range bigger ? -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Ron de Bruin" wrote in message ... Try this Sub test() Application.ScreenUpdating = False Dim numRows As Integer Dim R As Long Dim Rng As Range numRows = 1 Set Rng = ActiveSheet.UsedRange For R = Rng.Rows.Count To 1 Step -23 Rng.Rows(R + 1).Resize(numRows).EntireRow.insert Next R Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "C" wrote in message ... IS there a way to program Excel to insert a new line. For example I need to have a new line instered every 23 lines in a spreadsheet I am working on. Your help would be greatly appreciated! Christie |
All times are GMT +1. The time now is 04:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com