right function

Phil_Pearce

New Member
Joined
Feb 19, 2009
Messages
30
I would like to loop through all cells in column B6 onwards and change the cell so there are only 9 characters counting from the right. I would like to use the right function but i can not get it to loop through properly. Please help
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Maybe try:

Code:
Sub Test()
    Dim LastRow As Long
    Dim Cell As Range
    LastRow = Range("B" & Rows.Count).End(xlUp).Row
    For Each Cell In Range("B6:B" & LastRow)
        With Cell
            If Len(.Value) > 9 Then
                .Value = Right(.Value, 9)
            End If
        End With
    Next Cell
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,989
Messages
6,122,622
Members
449,093
Latest member
catterz66

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