![]() |
Add row and text between each row
I have an excel spreadsheet with 20k rows of data. Want to add a row
in between each one and in column A of each newly created row put in "=========" without the quotes. Can someone suggest a macro to do this? Thanks. JR |
Add row and text between each row
Have the below which basically works, just not sure how to add the
quoted text I listed in my original post into each line: Sub test() InsertSpaceRow ActiveSheet, 3, 10 End Sub 'takes a sheet , a start row number and an end row number Sub InsertSpaceRow(Wsh As Worksheet, rowStart As Long, rowEnd As Long) Dim i As Long Application.ScreenUpdating = False For i = rowEnd To rowStart Step -1 Wsh.Range(i & ":" & i).EntireRow.Insert Next End Sub |
Add row and text between each row
Give this a try...
Sub InsertLines() Dim wks As Worksheet Dim rng As Range Set wks = ActiveSheet With wks Set rng = .Cells(Rows.Count, "A").End(xlUp) Do While rng.Row 1 rng.EntireRow.Insert rng.Offset(-1, 0).Value = "'=========" Set rng = rng.Offset(-2, 0) Loop End With End Sub -- HTH... Jim Thomlinson "JR" wrote: I have an excel spreadsheet with 20k rows of data. Want to add a row in between each one and in column A of each newly created row put in "=========" without the quotes. Can someone suggest a macro to do this? Thanks. JR |
Add row and text between each row
Sub test() Dim i As Integer i = 2 Do Until Cells(i, 1).Value = "" If Cells(i, 1).Value = "" Then Exit Do Else: Cells(i, 1).Select Rows(i).Insert Shift:=xlDown Cells(i, 1).Value = "'=========" i = i + 2 End If Loop End Su -- dok11 ----------------------------------------------------------------------- dok112's Profile: http://www.excelforum.com/member.php...fo&userid=1058 View this thread: http://www.excelforum.com/showthread.php?threadid=53279 |
All times are GMT +1. The time now is 05:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com