Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
mohd21uk via OfficeKB.com
 
Posts: n/a
Default Obtain last four characters from a cell.

I am using a macro to validate a form. I would like cell A1 to equate to the
last four charecters of cell a4. For e.g if cell a1 is 552004k00 cell a4
should have the value 4k00. I would be grateful if you could provide this to
me in VBA code.

Thanks

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200605/1
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Obtain last four characters from a cell.

Range("A1").Value = Right(Range("A4").Value,4)

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"mohd21uk via OfficeKB.com" <u20517@uwe wrote in message
news:60615dea026f3@uwe...
I am using a macro to validate a form. I would like cell A1 to equate to

the
last four charecters of cell a4. For e.g if cell a1 is 552004k00 cell a4
should have the value 4k00. I would be grateful if you could provide this

to
me in VBA code.

Thanks

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200605/1



  #3   Report Post  
Posted to microsoft.public.excel.misc
mohd21uk via OfficeKB.com
 
Posts: n/a
Default Obtain last four characters from a cell.

I have tried this function but it still gives me errors. I get the E+15 error.
I am wondering how I can change this,

Bob Phillips wrote:
Range("A1").Value = Right(Range("A4").Value,4)

I am using a macro to validate a form. I would like cell A1 to equate to the
last four charecters of cell a4. For e.g if cell a1 is 552004k00 cell a4
should have the value 4k00. I would be grateful if you could provide this to
me in VBA code.

Thanks


--
Message posted via http://www.officekb.com
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Obtain last four characters from a cell.

I think it'll depend on what's in those last 4 characters.

with Range("A1")
.numberformat = "@" 'make it text
.Value = Right(Range("A4").Text,4)
end with

"mohd21uk via OfficeKB.com" wrote:

I have tried this function but it still gives me errors. I get the E+15 error.
I am wondering how I can change this,

Bob Phillips wrote:
Range("A1").Value = Right(Range("A4").Value,4)

I am using a macro to validate a form. I would like cell A1 to equate to the
last four charecters of cell a4. For e.g if cell a1 is 552004k00 cell a4
should have the value 4k00. I would be grateful if you could provide this to
me in VBA code.

Thanks


--
Message posted via http://www.officekb.com


--

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
Custom functions calculating time arguments Help Desperate Bill_De Excel Worksheet Functions 12 April 25th 06 02:22 AM
Number of characters in a cell (one row, merged columns) Dajana Excel Discussion (Misc queries) 1 September 19th 05 09:30 PM
cell color index comparison MINAL ZUNKE New Users to Excel 1 June 30th 05 07:11 AM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
if cell starts with characters formula Norman Kong via OfficeKB.com Excel Discussion (Misc queries) 3 March 24th 05 10:18 AM


All times are GMT +1. The time now is 07:41 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"