search for 1st non * in text

winde

New Member
Joined
Nov 27, 2018
Messages
32
Hi

Can i know how to find the first non "*" in a cell and return all the text after that?


example:

*****ant --> ant

**Bat --> Bat

*********cat --> cat


Thanks.
 
Here is the VBA version that you mentioned you might want to use...
Code:
[TABLE="width: 500"]
<tbody>[TR]
[TD]AfterLeadingAsterisks = Right(Range("A1"), Len(LTrim(Replace(Range("A1"), "*", " "))))[/TD]
[/TR]
</tbody>[/TABLE]


Hi Rick

How do i apply this to all text in Column A?

below is my vba code. how do i edit it from there?



sName = ActiveSheet.Name

Set ws = Sheets(sName)


With ws

Firstrow = .UsedRange.Cells(1).Row

Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row

Set rng = .Range("A" & Firstrow, Range("A" & Lastrow))

rng.select


WorksheetFunction.Right(Range("rng"), Len(LTrim(Replace(Range("rng"), "*", " "))))


End With
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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