Comma not showing up...

Skyybot

Well-known Member
Joined
Feb 18, 2023
Messages
875
Office Version
  1. 365
Platform
  1. Windows
Can anyone explain why the comma's aren't showing up here? I'm trying to remove rows with trailing comma's in description.
Option Explicit

VBA Code:
Sub Remove_Trailing_Colon()
Dim wb As Workbook, sht As Worksheet, rng As Range, cell As Range, i As Long, lRow As Long
Set wb = ThisWorkbook: Set sht = wb.Sheets(2)
lRow = sht.Rows.End(xlDown).Row
Set rng = sht.Range("B2:B" & lRow)
For Each cell In rng
    Trim (cell.Value)
Next cell
For i = lRow To 2 Step -1
    If Right(sht.Cells(i, 2).Value, 1) = "," Then
        sht.Rows(i).Delete
    End If
Next i
End Sub
Part NumberDescription
1393066#10 SS FLAT WASHER, BLK OXIDE
14757#10 SS FLAT WASHER,
14743#10 SS SPLIT LOCK WASHER
15213#10-32 SS ACORN NUT
15078#10-32 SS FLANGE NUT
15108#10-32 SS HEX NUT
17881#10-32 SS PAN PH MS, 1 1/2"
17879#10-32 SS PAN PH MS, 1"
17877#10-32 SS PAN PH MS, 1/2"
17878#10-32 SS PAN PH MS, 3/4"
53734#10-32 STEEL RIBBED NUTSERT
14755#6 SS FLAT WASHER,
14741#6 SS SPLIT LOCK WASHER
15210#6-32 SS ACORN NUT
15075#6-32 SS FLANGE NUT
15104#6-32 SS HEX NUT
17866#6-32 SS PAN PH MS, 1 1/2"
17864#6-32 SS PAN PH MS, 1"
17862#6-32 SS PAN PH MS, 1/2"
17863#6-32 SS PAN PH MS, 3/4"
29859#6-32 WELL NUT
1399718#8 PAN PH SM SCREW, 1 1/2", BLACK
1400513#8 PAN PH SM SCREW, BLACK, 1"
1400511#8 PAN PH SM SCREW, BLACK, 1/2"
1400512#8 PAN PH SM SCREW, BLACK, 3/4"
14756#8 SS FLAT WASHER,
14742#8 SS SPLIT LOCK WASHER
15211#8-32 SS ACORN NUT
15076#8-32 SS FLANGE NUT
15106#8-32 SS HEX NUT
17873#8-32 SS PAN PH MS, 1 1/2"
17871#8-32 SS PAN PH MS, 1"
17869#8-32 SS PAN PH MS, 1/2"
17870#8-32 SS PAN PH MS, 3/4"
53732#8-32 STEEL RIBBED NUTSERT
147591/4" SS FLAT WASHER
147451/4" SS SPLIT LOCK WASHER
152141/4-20 SS ACORN NUT
150801/4-20 SS FLANGE NUT
148041/4-20 SS HEX BOLT, 1"
148001/4-20 SS HEX BOLT, 1/2"
148021/4-20 SS HEX BOLT, 3/4"
147721/4-20 SS HEX NUT
13997191/4-20 SS PAN PH MS, 1/2", BLACK
537351/4-20 STEEL RIBBED NUTSERT
13930671/4X20 FLAT WASHER, BLACK OXIDE
147613/8" SS FLAT WASHER,
147473/8" SS SPLIT LOCK WASHER
147743/8-16 SS HEX NUT
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Nevermind. I forgot to change the cell value with the Trim cell value. Duh. Was getting the trailing "space".
VBA Code:
cell.Value = Trim(cell.Value)
 
Upvote 0
Solution

Forum statistics

Threads
1,215,265
Messages
6,123,961
Members
449,135
Latest member
jcschafer209

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