ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Year as text (https://www.excelbanter.com/excel-programming/273886-re-year-text.html)

Myrna Larson[_2_]

Year as text
 
To eliminate the space with the least hassle:

lastYear = Format$(ThisYear - 1)



On Thu, 7 Aug 2003 07:01:03 -0700, "ten" wrote:

Hi,
I have some year as integer I need to use as a text-
string. For instance I have the two variables thisYear and
lastYear, the latter calculated as lastYear = thisYear -1.

I need to do some string-excercises on these. However,
since I am using integer-calculation, Excel sees the
lastYear variable as a number.

I tried to do it with the Str() method:
lastYear = Str(thisYear - 1)
However, then I got a space in front: " 2002".

1) Are there better solutions?
2) How can I trim the space before the year away?

Thx!




All times are GMT +1. The time now is 07:33 PM.

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