![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 09:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com