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

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

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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