liam_conor
Board Regular
- Joined
- Oct 9, 2002
- Messages
- 180
I have a macro that loops throught all of the worksheets in a workbook and places a row inbetween all data that is different than from each other in column "A". However, it will not insert a row between data in column "A" if the different data is less than 2 in number.
Here it what I have so far:
Sub WorkshAct()
Dim ShList()
Dim ShCount As Integer
Dim x As Integer
ShCount = ActiveWorkbook.Sheets.Count
ReDim Preserve ShList(1 To ShCount)
For x = 2 To ShCount
Sheets(x).Select
InsertRows
Next x
End Sub
Sub InsertRows()
Dim iRow As Long
Dim iCount As Integer
iCount = 0
For iRow = [a65536].End(xlUp).Row - 1 To 3 Step -1
If Not IsEmpty(Cells(iRow, 1)) Then
If Cells(iRow, 1) <> Cells(iRow - 1, 1) Then
Rows(iRow).Insert
iCount = iCount + 1
End If
End If
Next iRow
End Sub
Any ideas/examples of how to do this?
Here it what I have so far:
Sub WorkshAct()
Dim ShList()
Dim ShCount As Integer
Dim x As Integer
ShCount = ActiveWorkbook.Sheets.Count
ReDim Preserve ShList(1 To ShCount)
For x = 2 To ShCount
Sheets(x).Select
InsertRows
Next x
End Sub
Sub InsertRows()
Dim iRow As Long
Dim iCount As Integer
iCount = 0
For iRow = [a65536].End(xlUp).Row - 1 To 3 Step -1
If Not IsEmpty(Cells(iRow, 1)) Then
If Cells(iRow, 1) <> Cells(iRow - 1, 1) Then
Rows(iRow).Insert
iCount = iCount + 1
End If
End If
Next iRow
End Sub
Any ideas/examples of how to do this?