Hi, Every body i have a little problem if you know how to help me please do it
the situation:
1) I have in a worksheet some cells with alphanumeric values like 3456* or 2341* whatever 2) I need find the Asterisc simbol and replace with "" 3) the number that I wait for will be 3456 and 2341
the problem:
i´m using this code: With Datos .Replace what:="*", Replacement:="", LookAt:=xlWhole End With
it replace ALL the range called Datos with a "" in other words, the code deletes Datos
Since * is a special character, I think you'll need a custom routine to do this. Here's a quick one I worked up:
Sub RemoveAsterisk(ByVal rngRemove As Range)
Dim lPos As Long Dim rngCell As Range Dim szValue As String
For Each rngCell In rngRemove szValue = rngCell.Value If Len(szValue) > 0 Then lPos = InStr(szValue, "*") If lPos > 0 Then rngCell.Value = Left$(szValue, lPos - 1) _ & Right$(szValue, Len(szValue) - lPos) End If End If Next rngCell
End Sub
-- Rob Bovey, MCSE The Payne Consulting Group http://www.payneconsulting.com * Please post all replies to this newsgroup * * I delete all unsolicited e-mail responses *
Stalin Torres <stali...@hotmail.com> wrote in message
> Hi, Every body > i have a little problem if you know how to help me please do it
> the situation:
> 1) I have in a worksheet some cells with alphanumeric values like 3456* or > 2341* whatever > 2) I need find the Asterisc simbol and replace with "" > 3) the number that I wait for will be 3456 and 2341
> the problem:
> i´m using this code: > With Datos > .Replace what:="*", Replacement:="", LookAt:=xlWhole > End With
> it replace ALL the range called Datos with a "" in other words, the code > deletes Datos
> Hi, Every body > i have a little problem if you know how to help me please do it
> the situation:
> 1) I have in a worksheet some cells with alphanumeric values like 3456* or > 2341* whatever > 2) I need find the Asterisc simbol and replace with "" > 3) the number that I wait for will be 3456 and 2341
> the problem:
> i´m using this code: > With Datos > .Replace what:="*", Replacement:="", LookAt:=xlWhole > End With
> it replace ALL the range called Datos with a "" in other words, the code > deletes Datos
-- Rob Bovey, MCSE The Payne Consulting Group http://www.payneconsulting.com * Please post all responses to this newsgroup * * I delete all unsolicited e-mail messages *
Laurent Longre <lon...@wanadoo.fr> wrote in message
> > Hi, Every body > > i have a little problem if you know how to help me please do it
> > the situation:
> > 1) I have in a worksheet some cells with alphanumeric values like 3456* or > > 2341* whatever > > 2) I need find the Asterisc simbol and replace with "" > > 3) the number that I wait for will be 3456 and 2341
> > the problem:
> > i´m using this code: > > With Datos > > .Replace what:="*", Replacement:="", LookAt:=xlWhole > > End With
> > it replace ALL the range called Datos with a "" in other words, the code > > deletes Datos
> -- > Rob Bovey, MCSE > The Payne Consulting Group > http://www.payneconsulting.com > * Please post all responses to this newsgroup * > * I delete all unsolicited e-mail messages *
> > > Hi, Every body > > > i have a little problem if you know how to help me please do it
> > > the situation:
> > > 1) I have in a worksheet some cells with alphanumeric values like 3456* > or > > > 2341* whatever > > > 2) I need find the Asterisc simbol and replace with "" > > > 3) the number that I wait for will be 3456 and 2341
> > > the problem:
> > > i´m using this code: > > > With Datos > > > .Replace what:="*", Replacement:="", LookAt:=xlWhole > > > End With
> > > it replace ALL the range called Datos with a "" in other words, the code > > > deletes Datos
> Do you speak a bit French, Rob? In such cases, we say : "Pourquoi faire > simple quand on peut faire compliqué?" (difficult too translate)
Hi Laurent,
No, I don't speak French. But I bet the above resembles an American expression that goes something like: "If it was a snake it would've bit me." <g>.
-- Rob Bovey, MCSE The Payne Consulting Group http://www.payneconsulting.com * Please post all responses to this newsgroup * * I delete all unsolicited e-mail messages *
Ah, mon cher Rob, but it sounds *so* much more elegant in French. Except that it translates into the opposite direction: "Why simplify things when you can make them complicated?", which pretty much sums up classic French cooking, philosophy, the language arts, and driving habits. <g>
Glad to have discovered this NG. Many thanks to you guys. Now, back to the DLL's.
> > Do you speak a bit French, Rob? In such cases, we say : "Pourquoi faire > > simple quand on peut faire compliqué?" (difficult too translate)
> Hi Laurent,
> No, I don't speak French. But I bet the above resembles an American > expression that goes something like: "If it was a snake it would've bit me." > <g>.
> Ah, mon cher Rob, but it sounds *so* much more elegant in French. Except that it > translates into the opposite direction: "Why simplify things when you can make > them complicated?", which pretty much sums up classic French cooking, > philosophy, the language arts, and driving habits. <g>
> Glad to have discovered this NG. Many thanks to you guys. Now, back to the DLL's.
> Dave Braden > newbie
> Rob Bovey wrote:
> > > Do you speak a bit French, Rob? In such cases, we say : "Pourquoi faire > > > simple quand on peut faire compliqué?" (difficult too translate)
> > Hi Laurent,
> > No, I don't speak French. But I bet the above resembles an American > > expression that goes something like: "If it was a snake it would've bit me." > > <g>.
> Ah, mon cher Rob, but it sounds *so* much more elegant in French. Except that it > translates into the opposite direction: "Why simplify things when you can make > them complicated?", which pretty much sums up classic French cooking, > philosophy, the language arts, and driving habits. <g>