View Single Post
  #2   Report Post  
Jim Cone
 
Posts: n/a
Default Macro that double spaces rows for an entire worksheet?

Gary,
Give this a try...
'---------------------
Sub I_Need_Space()
'Inserts a row between every row in the selection.
'Jim Cone - San Francisco, USA - November 05, 2005
Dim rngSelect As Excel.Range
Dim lngRow As Long
Set rngSelect = Selection.Columns(1)
If rngSelect.Rows.Count = Rows.Count Then
If MsgBox("Every row is selected. Do you want to continue ? ", _
vbQuestion + vbOKCancel, " Gary's Idea") = vbCancel Then
Set rngSelect = Nothing
Exit Sub
End If
End If
Application.ScreenUpdating = False
For lngRow = rngSelect.Rows.Count To 2 Step -1
rngSelect.Rows(lngRow).EntireRow.Insert
Next 'lngRow
Application.ScreenUpdating = True
Set rngSelect = Nothing
End Sub
'-----------------

"glaves123"
wrote in message


Hello,
I regularly import data into excel and then need to double space every row
manually, or add a new empty row between each line of data manually. Does
anyone know a macro where I can highlight all of the worksheet data, run the
macro, and everything will be double spaced automatically? Thanks for any
input!
Gary