For lRow = 353 To 2 Step -1 what does this mean

andycreber

Board Regular
Joined
May 20, 2010
Messages
74
Office Version
  1. 2016
I am using this bit of code in my macro I found to nearly work but could someone please tell me what this means

For lRow = 353 To 2 Step -1

does it only go down to row 353?

I want it to work on columns B & C only, thanks

The full code is:
Code:
Dim lRow As Integer
Dim intCol As Long
Dim rngCell As Range, fn


Set fn = Application.WorksheetFunction


For intCol = 2 To 3
    For lRow = 353 To 2 Step -1
        Set rngCell = Cells(lRow, intCol)
        With rngCell
            .Value = fn.Substitute(rngCell.Value, Chr(160), Chr(32))
            .Value = Trim(rngCell.Value)
        End With
        If Len(rngCell) = 0 Then
            rngCell.Delete shift:=xlUp
        End If
        Set rngCell = Nothing
    Next lRow
Next intCol
 
Last edited by a moderator:

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
It starts at the (last) row and works it way up.
Often used when deleting rows, since deleting rows would then make the macro miss/skip data not accounted for during the delete.
 
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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