PC Review


Reply
Thread Tools Rate Thread

how can i create a macro

 
 
=?Utf-8?B?YW5kcmVzZzE5NzU=?=
Guest
Posts: n/a
 
      3rd Oct 2006
how can i create a macro that in column "D", look for first cell with a
value, go down until blank cell, delete three rows down, and continue the
same procedure.

lets say:

column D

row 5 100
row 6 200
row 7 blank
row 8 500
row 9 blank
row 10 400
row 11 80
row 12 blank
row 13 90
row 14 blank
row 15 100
row 16 300

result should be:

column D

row 5 100
row 6 200
row 400
row 80
row 100
row 300

thanks a lot
 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2FuZHk=?=
Guest
Posts: n/a
 
      3rd Oct 2006
Not sure what your trying to do but I was able to replicate your example

Sandy

Sub TripleDelete()
Dim MyRange As Range, MyCells As Object, i As Integer
Set MyRange = [D]
For Each MyCells In MyRange
If MyCells.Value = Empty Then
Range(MyCells.Address, _
MyCells.Offset(2, 0).Address).EntireRow.Delete
End If
Next MyCells
End Sub

"andresg1975" wrote:

> how can i create a macro that in column "D", look for first cell with a
> value, go down until blank cell, delete three rows down, and continue the
> same procedure.
>
> lets say:
>
> column D
>
> row 5 100
> row 6 200
> row 7 blank
> row 8 500
> row 9 blank
> row 10 400
> row 11 80
> row 12 blank
> row 13 90
> row 14 blank
> row 15 100
> row 16 300
>
> result should be:
>
> column D
>
> row 5 100
> row 6 200
> row 400
> row 80
> row 100
> row 300
>
> thanks a lot

 
Reply With Quote
 
=?Utf-8?B?UG9wcyBKYWNrc29u?=
Guest
Posts: n/a
 
      3rd Oct 2006
This should accomplish your purpose.

Sub test()

Range("D5").activate
Do
If Activecell = "" then
Range(Activecell, Activecell.Offset(2,0)).select
Selection.EntireRow.Delete shift:=xlUp
else
Activecell.Offset(1,0).Activate
end if
Loop until (whatever conditions you wish to set)
End Sub

--
Pops Jackson


"andresg1975" wrote:

> how can i create a macro that in column "D", look for first cell with a
> value, go down until blank cell, delete three rows down, and continue the
> same procedure.
>
> lets say:
>
> column D
>
> row 5 100
> row 6 200
> row 7 blank
> row 8 500
> row 9 blank
> row 10 400
> row 11 80
> row 12 blank
> row 13 90
> row 14 blank
> row 15 100
> row 16 300
>
> result should be:
>
> column D
>
> row 5 100
> row 6 200
> row 400
> row 80
> row 100
> row 300
>
> thanks a lot

 
Reply With Quote
 
=?Utf-8?B?YW5kcmVzZzE5NzU=?=
Guest
Posts: n/a
 
      3rd Oct 2006
I want to loop until there is no more cells with values
how can i do that, thanks a lot

"Pops Jackson" wrote:

> This should accomplish your purpose.
>
> Sub test()
>
> Range("D5").activate
> Do
> If Activecell = "" then
> Range(Activecell, Activecell.Offset(2,0)).select
> Selection.EntireRow.Delete shift:=xlUp
> else
> Activecell.Offset(1,0).Activate
> end if
> Loop until (whatever conditions you wish to set)
> End Sub
>
> --
> Pops Jackson
>
>
> "andresg1975" wrote:
>
> > how can i create a macro that in column "D", look for first cell with a
> > value, go down until blank cell, delete three rows down, and continue the
> > same procedure.
> >
> > lets say:
> >
> > column D
> >
> > row 5 100
> > row 6 200
> > row 7 blank
> > row 8 500
> > row 9 blank
> > row 10 400
> > row 11 80
> > row 12 blank
> > row 13 90
> > row 14 blank
> > row 15 100
> > row 16 300
> >
> > result should be:
> >
> > column D
> >
> > row 5 100
> > row 6 200
> > row 400
> > row 80
> > row 100
> > row 300
> >
> > thanks a lot

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a macro to create excel line graph with coloured pointers anddata lables anuj datta Microsoft Excel Charting 1 30th Sep 2009 04:04 PM
macro to create a new workbook/ macro to copy columns TG Microsoft Excel Programming 0 11th Sep 2009 06:55 PM
how to create an auto reply rule/macro that wont create a new mess squalltheonly Microsoft Outlook Discussion 4 15th Nov 2008 04:03 PM
create Macro, Outlook 2007 - create is grayed out Dave Horne Microsoft Outlook 2 4th Nov 2007 09:45 AM
Create WB, create new Sht, paste data. (Macro not working) =?Utf-8?B?UmljayBTLg==?= Microsoft Excel Programming 6 31st Oct 2007 05:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:38 PM.