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
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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
 
Upvote 0
:p;)Cheers to Vog!!!

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


Great Thanks!!!
 
Upvote 0
Yes that is correct...i'm learning from everywhere possible.

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

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,054
Latest member
juliecooper255

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
Back
Top