Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JR JR is offline
external usenet poster
 
Posts: 8
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
JR JR is offline
external usenet poster
 
Posts: 8
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

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
Using TEXT and &TEXT - display numbers with commas, underline text Gary Excel Discussion (Misc queries) 3 May 5th 23 03:46 AM
Sumif text is contained winthin a longer text string in a cell Johnny M[_2_] Excel Worksheet Functions 3 March 21st 07 02:50 PM
Text does not display in "Text boxs" and when wrapping text in a c Esteban Excel Discussion (Misc queries) 1 March 8th 07 11:59 PM
Excel VBA: Worksheet cell .Text property: 1024 bytes text len limit loyso Excel Programming 7 May 3rd 05 02:51 PM
extracting text from within a cell - 'text to rows@ equivalent of 'text to columns' Dan E[_2_] Excel Programming 4 July 30th 03 06:43 PM


All times are GMT +1. The time now is 10:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"