Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My worksheet has the following headings:
RegNo FirstName LastName Country Registered The sheet has over 500 rows of data. Can anyone suggest a macro that would allow me to insert a blank row after every 4 lines of data? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Tester10()
Set rng = Cells(5, 1) For i = 9 To 1000 Step 4 If IsEmpty(Cells(i, 1)) Then Exit For Set rng = Union(rng, Cells(i, 1)) Next If Not rng Is Nothing Then rng.EntireRow.Insert End If End Sub Tested in Excel 2000. Not sure it would work in xl97, but haven't tested there. Should work in xl2000 and later I would think. -- Regards, Tom Ogilvy "Phil" wrote in message ... My worksheet has the following headings: RegNo FirstName LastName Country Registered The sheet has over 500 rows of data. Can anyone suggest a macro that would allow me to insert a blank row after every 4 lines of data? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom, tested in '97 works fine
-- Paul B Always backup your data before trying something new Using Excel 97 & 2000 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** "Tom Ogilvy" wrote in message ... Sub Tester10() Set rng = Cells(5, 1) For i = 9 To 1000 Step 4 If IsEmpty(Cells(i, 1)) Then Exit For Set rng = Union(rng, Cells(i, 1)) Next If Not rng Is Nothing Then rng.EntireRow.Insert End If End Sub Tested in Excel 2000. Not sure it would work in xl97, but haven't tested there. Should work in xl2000 and later I would think. -- Regards, Tom Ogilvy "Phil" wrote in message ... My worksheet has the following headings: RegNo FirstName LastName Country Registered The sheet has over 500 rows of data. Can anyone suggest a macro that would allow me to insert a blank row after every 4 lines of data? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks!
Regards, Tom Ogilvy "Paul B" wrote in message ... Tom, tested in '97 works fine -- Paul B Always backup your data before trying something new Using Excel 97 & 2000 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** "Tom Ogilvy" wrote in message ... Sub Tester10() Set rng = Cells(5, 1) For i = 9 To 1000 Step 4 If IsEmpty(Cells(i, 1)) Then Exit For Set rng = Union(rng, Cells(i, 1)) Next If Not rng Is Nothing Then rng.EntireRow.Insert End If End Sub Tested in Excel 2000. Not sure it would work in xl97, but haven't tested there. Should work in xl2000 and later I would think. -- Regards, Tom Ogilvy "Phil" wrote in message ... My worksheet has the following headings: RegNo FirstName LastName Country Registered The sheet has over 500 rows of data. Can anyone suggest a macro that would allow me to insert a blank row after every 4 lines of data? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() -----Original Message----- My worksheet has the following headings: RegNo FirstName LastName Country Registered The sheet has over 500 rows of data. Can anyone suggest a macro that would allow me to insert a blank row after every 4 lines of data? . c=1 do until isempty(range("a" & c)) = true c=c+1 loop for y=1 to c step 4 columns(y).select seltion.insert shift:=xldown next y have a play around with that, you may need to alter it slightly. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Phil,
This code is dependent on column A having something in all cells. It will loop until it finds a blank cell. It places the first insert after the 5th row (includes header) and than separates groups into 4 rows each. Does over 500 rows almost instantaneously in Excel97. Application.ScreenUpdating = False ' prevents flicker, speeds it up Dim x As Long x = 6 Do Until Cells(x, 1) = "" Rows(x).Insert x = x + 5 Loop Application.ScreenUpdating = True -- sb "Phil" wrote in message ... My worksheet has the following headings: RegNo FirstName LastName Country Registered The sheet has over 500 rows of data. Can anyone suggest a macro that would allow me to insert a blank row after every 4 lines of data? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
inserting rows inbetween rows of data ? | Excel Discussion (Misc queries) | |||
Inserting rows | Excel Discussion (Misc queries) | |||
Copying & Inserting Rows w/o Affecting other Rows Etc. | Excel Worksheet Functions | |||
Inserting Blank rows after every row upto 2500 rows | Excel Worksheet Functions | |||
Inserting rows | Excel Worksheet Functions |