Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default how can i create a macro

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default how can i create a macro

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: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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default how can i create a macro

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default how can i create a macro

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
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
Create a macro to create excel line graph with coloured pointers anddata lables anuj datta Charts and Charting in Excel 1 September 30th 09 04:04 PM
Using a macro to create a macro in another workbook Gizmo63 Excel Worksheet Functions 2 May 15th 06 09:48 AM
could any one please tell me how can i create a macro that runs other macro VB Script for Excel Excel Programming 2 March 23rd 06 06:17 AM
how to create a macro that runs other macro in the same workbook VB Script for Excel Excel Programming 4 March 23rd 06 03:53 AM
Use existing macro to create another macro fullers Excel Programming 1 February 16th 06 09:56 AM


All times are GMT +1. The time now is 09:28 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"