Remove numbering from row entries

RY_VT

Board Regular
Joined
Oct 31, 2015
Messages
80
Wanted macro code to remove the numbers, spacing, and dash from the entries that would be the row headings (example would be remove the " 1 - " from " 1 - AA". The entry will consist of 4 spaces, the number, a space, a dash, and another space before the data. The width of the row will vary, but I have the code to select that range already.

The data would look like below:

[TABLE="class: grid, width: 1000"]
<tbody>[TR]
[TD] 1 - AA[/TD]
[TD] 2 - AB[/TD]
[TD] 3 - DF[/TD]
[TD] 4 - BA[/TD]
[TD] 5 - BB[/TD]
[TD] 6 - BC[/TD]
[TD] 7 - BD[/TD]
[TD] 8 - Bdd[/TD]
[TD] 9 - klakd[/TD]
[TD] 10 - AAAAA[/TD]
[TD] 11 - AAAAAA[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="class: grid, width: 50"]
<tbody></tbody>[/TABLE]


Any help would be appreciated.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Try:-
Based on row 1, alter "Set" line to suit
Code:
[COLOR=Navy]Sub[/COLOR] MG02Nov39
[COLOR=Navy]Dim[/COLOR] Rng [COLOR=Navy]As[/COLOR] Range, Dn [COLOR=Navy]As[/COLOR] Range
 [COLOR=Navy]Set[/COLOR] Rng = Range(Range("A1"), Cells(1, Columns.Count).End(xlToLeft))
[COLOR=Navy]For[/COLOR] [COLOR=Navy]Each[/COLOR] Dn [COLOR=Navy]In[/COLOR] Rng
    Dn.Value = Trim(Split(Dn.Value, "-")(1))
[COLOR=Navy]Next[/COLOR] Dn
[COLOR=Navy]End[/COLOR] [COLOR=Navy]Sub[/COLOR]
Regards Mick
 
Last edited:
Upvote 0

Forum statistics

Threads
1,225,468
Messages
6,185,162
Members
453,281
Latest member
shantor

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