ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using a Macro in Excel 2004 to move entered data from one sheet toanother and space between rows when next data is entered? (https://www.excelbanter.com/excel-programming/412043-using-macro-excel-2004-move-entered-data-one-sheet-toanother-space-between-rows-when-next-data-entered.html)

[email protected]

Using a Macro in Excel 2004 to move entered data from one sheet toanother and space between rows when next data is entered?
 
I am trying to use a macro to do the following example:

Row 1 = data
Need to space
Row 3 = data
Need to space
Row 5 = data

Can anyone help???

Thanks,
Sandra M.
Texas

Susan

Using a Macro in Excel 2004 to move entered data from one sheetto another and space between rows when next data is entered?
 
i'll bite. :) SAVE your stuff before you try this in case it doesn't
do what you want.

========================
Sub bella()

Dim r As Long
Dim V As Variant
Dim x As Range
Dim myRange As Range
Dim ws As Worksheet
Dim LastRow As Long

Set ws = ActiveSheet
LastRow = ws.Cells(5000, 1).End(xlUp).Row
Set myRange = ws.Range("a1:a" & LastRow)

For r = myRange.Rows.Count To 1 Step -1
V = myRange.Cells(r, 1).Value
If V = " " Then
'do nothing
Else
Set x = myRange.Cells(r, 1)
x.EntireRow.Insert
End If
Next r

End Sub
========================
it's working on column A, so if that's not what you want, you'll have
to change references to column letters & numbers.
hope it helps!
susan




On Jun 4, 10:31*am, wrote:
I am trying to use a macro to do the following example:

Row 1 = data
Need to space
Row 3 = data
Need to space
Row 5 = data

Can anyone help???

Thanks,
Sandra M.
Texas




All times are GMT +1. The time now is 01:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com