![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: OKC
Posts: 98
|
i have a column of like sets of data. can a macro be written to insert a blank row at the end of each set of like data:
1966 1966 1966 1988 1988 1988 1921 1921 etc. etc. |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Try the following:
Sub InsertBlankRows() Dim ColOfData As Integer ColOfData = 1 For i = ActiveSheet.UsedRange.Columns(ColOfData).Rows.Count To 1 Step -1 If Cells(i, ColOfData) <> Cells(i + 1, ColOfData) Then _ Cells(i + 1, ColOfData).EntireRow.Insert Next i End Sub Change ColOfData to the number of the column that holds your data (ie 1=A, 2=B)
__________________
Kind regards, Al Chara |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: OKC
Posts: 98
|
after it spasmed for a few minutes, it worked wonderfully, thank you very much
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|