Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Year as text
Sub test()
Dim Yr As Long, S As String, La As String For Yr = 2000 To 2003 S = CStr(Yr) La = CStr(Yr - 1) MsgBox "Year was " & S & Chr(10) & _ "and then we talked about " & La Next End Sub -- HTH. Best wishes Harald Excel MVP Followup to newsgroup only please. "ten" wrote in message ... 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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Displaying month or year as text | Excel Worksheet Functions | |||
Enter month and year as text | New Users to Excel | |||
Summing on year and text conditions | Excel Worksheet Functions | |||
Lookup function w/Text and Year | Excel Worksheet Functions | |||
Year as text | Excel Programming |