Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Macro to delete Rows 1, 3 and 10

Hello All,
I am using Office XP
I have a group of data in Column A in set of 10 records separated by a blank
row.
Eg.
1
2
3
4
5
6
7
8
9
10
<blank row
11
....
....
20
<blank row
and so on so forth

I wish to delete Row Nos. 1, 3 and 10 from each group of 10 Records, so that
each new group would consist of only 7 Records each. I hope I have made
myself clear

Any help or suggestion to achieve this would be appreciated.
TIA
Rashid Khan


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Macro to delete Rows 1, 3 and 10

Sub test()
Dim i As Long, rng As Range

With ActiveSheet
For i = 1 To .Cells(Rows.Count, 1).End(xlUp).Row Step 11
If rng Is Nothing Then
Set rng = Union(Rows(i), Rows(i + 2), Rows(i + 9))
Else
Set rng = Union(rng, Rows(i), Rows(i + 2), Rows(i + 9))
End If
Next

' Debug.Print rng.Address
rng.Delete xlShiftUp

End With
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Rashid Khan" wrote in message
...
Hello All,
I am using Office XP
I have a group of data in Column A in set of 10 records separated by a

blank
row.
Eg.
1
2
3
4
5
6
7
8
9
10
<blank row
11
...
...
20
<blank row
and so on so forth

I wish to delete Row Nos. 1, 3 and 10 from each group of 10 Records, so

that
each new group would consist of only 7 Records each. I hope I have made
myself clear

Any help or suggestion to achieve this would be appreciated.
TIA
Rashid Khan




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Thanks - Macro to delete Rows 1, 3 and 10

Hi Rob,
Thanks a lot for your time and effort. It works lika a charm. You people
are really a genious lot.
Rashid
"Rob van Gelder" wrote in message
...
Sub test()
Dim i As Long, rng As Range

With ActiveSheet
For i = 1 To .Cells(Rows.Count, 1).End(xlUp).Row Step 11
If rng Is Nothing Then
Set rng = Union(Rows(i), Rows(i + 2), Rows(i + 9))
Else
Set rng = Union(rng, Rows(i), Rows(i + 2), Rows(i + 9))
End If
Next

' Debug.Print rng.Address
rng.Delete xlShiftUp

End With
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Rashid Khan" wrote in message
...
Hello All,
I am using Office XP
I have a group of data in Column A in set of 10 records separated by a

blank
row.
Eg.
1
2
3
4
5
6
7
8
9
10
<blank row
11
...
...
20
<blank row
and so on so forth

I wish to delete Row Nos. 1, 3 and 10 from each group of 10 Records, so

that
each new group would consist of only 7 Records each. I hope I have made
myself clear

Any help or suggestion to achieve this would be appreciated.
TIA
Rashid Khan






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to delete rows Aceensor Excel Discussion (Misc queries) 5 November 14th 08 03:45 PM
Macro to delete rows Hankjam[_2_] Excel Discussion (Misc queries) 4 October 1st 08 03:58 PM
My Macro Won't Delete Rows?? VexedFist New Users to Excel 3 April 16th 07 04:14 PM
Delete all Rows Macro Wanna Learn Excel Discussion (Misc queries) 5 March 6th 07 10:06 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM


All times are GMT +1. The time now is 06:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"