Delete Mark "/" in Only Last Position

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,077
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi...

Find mark "/" and delete it if only in the last (right) position
i have using Find "/" and Replace but all mark "/" replaced...

please, see this sample :

[TABLE="class: tableizer-table"]
<tbody>[TR="class: tableizer-firstrow"]
[TH]data[/TH]
[TH]after fomula[/TH]
[/TR]
[TR]
[TD]JL. SAOMATI RT 03/07, SAIL/[/TD]
[TD]JL. SAOMATI RT 03/07, SAIL[/TD]
[/TR]
[TR]
[TD]JL. BELANAK IV/452 LIMBUNGAN[/TD]
[TD]JL. BELANAK IV/452 LIMBUNGAN[/TD]
[/TR]
[TR]
[TD]JL. BUNGA HARUM 7 HARJOSARI/[/TD]
[TD]JL. BUNGA HARUM 7 HARJOSARI[/TD]
[/TR]
[TR]
[TD]JL. JEND.SUDIRMAN/BLOCK B RAYA[/TD]
[TD]JL. JEND.SUDIRMAN/BLOCK B RAYA[/TD]
[/TR]
[TR]
[TD]JL. MUSLIMIN TANAH DATAR/PKB KOTA[/TD]
[TD]etc..[/TD]
[/TR]
[TR]
[TD]JL. LEMBAH MULIA NO.01 SUKAMAJU/[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

would you help me..

thanks..

m.susanto
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
muhammad susanto,

1. What version of Excel, and, Windows are you using?

2. Are you using a PC or a Mac?


Here is a macro solution for you to consider.

Sample raw data:


Excel 2007
A
1data
2JL. SAOMATI RT 03/07, SAIL/
3JL. BELANAK IV/452 LIMBUNGAN
4JL. BUNGA HARUM 7 HARJOSARI/
5JL. JEND.SUDIRMAN/BLOCK B RAYA
6JL. MUSLIMIN TANAH DATAR/PKB KOTA
7JL. LEMBAH MULIA NO.01 SUKAMAJU/
8
Sheet1


After the macro:


Excel 2007
A
1data
2JL. SAOMATI RT 03/07, SAIL
3JL. BELANAK IV/452 LIMBUNGAN
4JL. BUNGA HARUM 7 HARJOSARI
5JL. JEND.SUDIRMAN/BLOCK B RAYA
6JL. MUSLIMIN TANAH DATAR/PKB KOTA
7JL. LEMBAH MULIA NO.01 SUKAMAJU
8
Sheet1


Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

1. Copy the below code
2. Open your NEW workbook
3. Press the keys ALT + F11 to open the Visual Basic Editor
4. Press the keys ALT + I to activate the Insert menu
5. Press M to insert a Standard Module
6. Where the cursor is flashing, paste the code
7. Press the keys ALT + Q to exit the Editor, and return to Excel
8. To run the macro from Excel press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

Code:
Sub DeleteFromLastPosition()
' hiker95, 10/10/2015, ME893232
Dim Addr As String
Addr = "A2:A" & Cells(Rows.Count, "A").End(xlUp).Row
Range(Addr) = Evaluate(Replace("IF(Right(@,1)=""/"",LEFT(@,LEN(@)-1),@)", "@", Addr))
End Sub

Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm, and, answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.

Then run the DeleteFromLastPosition macro.
 
Upvote 0

Forum statistics

Threads
1,223,247
Messages
6,171,007
Members
452,374
Latest member
keccles

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