ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   last char of a string (https://www.excelbanter.com/excel-programming/345179-last-char-string.html)

Buddy Lee

last char of a string
 
how can I get the last char of a string?
e.g. "abcdefg" - last char is "g"
does excel know something like "txt[ Len(txt) ]"???

--

icq 25372592



Mark H. Shin

last char of a string
 
myString = "abcdefg"

lastChar = Right(myString,1)

"Buddy Lee" wrote in message
...
how can I get the last char of a string?
e.g. "abcdefg" - last char is "g"
does excel know something like "txt[ Len(txt) ]"???

--

icq 25372592




Buddy Lee

last char of a string
 
thank you ;)

--

icq 25372592
"Mark H. Shin" píše v diskusním příspěvku
...
myString = "abcdefg"

lastChar = Right(myString,1)

"Buddy Lee" wrote in message
...
how can I get the last char of a string?
e.g. "abcdefg" - last char is "g"
does excel know something like "txt[ Len(txt) ]"???

--

icq 25372592






Tom Ogilvy

last char of a string
 
txt = "abcdefg"
chr = Right(txt,1)
msgbox chr

--
Regards,
Tom Ogilvy



"Buddy Lee" wrote in message
...
how can I get the last char of a string?
e.g. "abcdefg" - last char is "g"
does excel know something like "txt[ Len(txt) ]"???

--

icq 25372592





quartz[_2_]

last char of a string
 
Hi,

Use "Right" as in:

sText = Right(YourString, 1)
MsgBox sText

HTH/

"Buddy Lee" wrote:

how can I get the last char of a string?
e.g. "abcdefg" - last char is "g"
does excel know something like "txt[ Len(txt) ]"???

--

icq 25372592




Toppers

last char of a string
 
Hi,

Right(txt,1) will give "g" if txt="abcdefg"

"Buddy Lee" wrote:

how can I get the last char of a string?
e.g. "abcdefg" - last char is "g"
does excel know something like "txt[ Len(txt) ]"???

--

icq 25372592




K Dales[_2_]

last char of a string
 
Right(Text,1) will do it.
--
- K Dales


"Buddy Lee" wrote:

how can I get the last char of a string?
e.g. "abcdefg" - last char is "g"
does excel know something like "txt[ Len(txt) ]"???

--

icq 25372592




Vic Eldridge[_3_]

last char of a string
 
Hi Buddy,

IIRC, the Right() function was introduced to VBA in the Office 2000 version.
So if you need to support earlier versions, you could use a combination of
the Mid() & Len() functions.

Regards,
Vic Eldridge


"Buddy Lee" wrote:

how can I get the last char of a string?
e.g. "abcdefg" - last char is "g"
does excel know something like "txt[ Len(txt) ]"???

--

icq 25372592




Dave Peterson

last char of a string
 
Right has been there a long time before xl2k.

I bet you were thinking of instrrev.



Vic Eldridge wrote:

Hi Buddy,

IIRC, the Right() function was introduced to VBA in the Office 2000 version.
So if you need to support earlier versions, you could use a combination of
the Mid() & Len() functions.

Regards,
Vic Eldridge

"Buddy Lee" wrote:

how can I get the last char of a string?
e.g. "abcdefg" - last char is "g"
does excel know something like "txt[ Len(txt) ]"???

--

icq 25372592




--

Dave Peterson

Vic Eldridge[_3_]

last char of a string
 
I bet you were thinking of instrrev.

I think you've won that bet Dave.
Thanks for the correction.

Regards,
Vic Eldridge




"Dave Peterson" wrote:

Right has been there a long time before xl2k.

I bet you were thinking of instrrev.



Vic Eldridge wrote:

Hi Buddy,

IIRC, the Right() function was introduced to VBA in the Office 2000 version.
So if you need to support earlier versions, you could use a combination of
the Mid() & Len() functions.

Regards,
Vic Eldridge

"Buddy Lee" wrote:

how can I get the last char of a string?
e.g. "abcdefg" - last char is "g"
does excel know something like "txt[ Len(txt) ]"???

--

icq 25372592




--

Dave Peterson



All times are GMT +1. The time now is 12:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com