Please explain this macro for me..please kindly, thank you!

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
:)In the code below i want a few clarification...

#1. does i as long means that i col A?

and below that is writen for i = 512 to 1 step -1; does this means it will go till row 512 of col A
and #2. what does to 1 step -1 mean?

#3. with cells(i,1); what is tis supose to do?

Please help...and explain this..thanks alot!
I'm learning all this from you guys thanks alot!

Sub exa1()
Dim i As Long

For i = 512 To 1 Step -1
With Cells(i, 1)
If Len(.Value) Then .Offset(1).Resize(4).EntireRow.Delete
End With
Next
End Sub
 

Some videos you may like

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Does this help?

Code:
Sub exa1()
Dim i As Long ' declares i as a long integer (can hold values from -2,147,483,648 to 2,147,483,647)
For i = 512 To 1 Step -1 ' loop backwards freom row 512 to row 1, one row at a time
    With Cells(i, 1) ' cells(i,1) means A1 when i = 1, A2 when i = 2 and so on
        If Len(.Value) Then .Offset(1).Resize(4).EntireRow.Delete
    End With
Next
End Sub
 

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
:p;)Cheers to Vog!!!

And to who so ever created this site and So called amazing helpfull BOARD..


Great Thanks!!!
 

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Yes that is correct...i'm learning from everywhere possible.

Vog~! Thanks alot once for all your help....;)
 

Watch MrExcel Video

Forum statistics

Threads
1,123,295
Messages
5,600,785
Members
414,405
Latest member
Zaurb

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top