Column Programs are the results of concatenated cells with commas. I need to be able to remove all commas at end of each cell. I cant seem to use find and replace functions.
Thanks
Column Programs are the results of concatenated cells with commas. I need to be able to remove all commas at end of each cell. I cant seem to use find and replace functions.
Thanks
In your file, I highlighted the data in column B,
used CTRL H (find/replace)
Find ,
Replace (nothing - leave blank)
\It worked fine for me?
1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
2. If your question is resolved, mark it SOLVED using the thread tools
3. Click on the star if you think someone helped you
Regards
Ford
If you've got intermediate commas but you only want to remove any end commas, then if you'd also like a VBA approach, maybe:![]()
Sub uuu() Dim a, c, x a = Range("B1", Cells(Rows.Count, "b").End(3)) For Each x In a c = c + 1 Do If Right(Trim(x), 1) = "," Then x = Left(x, Len(x) - 1) Else Exit Do Loop a(c, 1) = x Next x Range("B1", Cells(Rows.Count, "b").End(3)) = a End Sub
Thank you for this. I just posted the same question
FWIW:
![]()
Sub danallamasy() Dim x As Range With Application .ScreenUpdating = False .Calculation = xlCalculationManual End With For Each x In Range("B1:B" & Range("B" & Rows.Count).End(3).row) If Right(x, 2) = ", " Then With x Do Until Right(x, 1) <> " " And Right(x, 1) <> "," x = Left(x, Len(x) - 1) Loop End With End If Next x With Application .ScreenUpdating = True .Calculation = xlCalculationAutomatic End With End Sub
This should do
![]()
Sub test() Dim a, i As Long With Range("b2", Range("b" & Rows.Count).End(xlUp)) a = .Value With CreateObject("VBScript.RegExp") .Pattern = "(, *)+$" For i = 1 To UBound(a, 1) a(i, 1) = .Replace(a(i, 1), "") Next End With .Value = a End With End Sub
Not sure what is going on.. but can't post my solution.. keep getting some firewall message..
Found a thread in the Water Cooler about it.. but nothing i do will allow me to post the code i made..![]()
Last edited by apo; 06-15-2015 at 09:43 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks