Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default 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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default 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



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default 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



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default 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



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I find a value from one cell in a char string in another? tiredazdaddy Excel Worksheet Functions 2 November 20th 08 05:40 PM
How to retrieve certain char within a string? Eric Excel Discussion (Misc queries) 1 July 3rd 07 03:02 AM
How do i get the last position of a char (space) in a string? EsPoNjOsO Excel Worksheet Functions 1 October 12th 06 11:55 AM
string/char CONTAINS function? jim sturtz Excel Worksheet Functions 3 May 31st 06 07:20 PM
Validation through VBA using string has 255 char limit?????? Allan[_3_] Excel Programming 0 May 6th 04 11:51 PM


All times are GMT +1. The time now is 01:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright Š2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"