Issue in Sheet content: number to string !

General discussion on OpenOffice Calc and its spreadsheets.

Issue in Sheet content: number to string !

Postby Ricky G. Marion » Sat Sep 06, 2014 6:47 am

I Input in a1: mickey
and in a2:

// that is what I did in the spreadsheet

using this code in basic IDE:
Code: Select all
Dim Doc As Object
Dim Sheet As Object
Dim Cell As Object

Doc = ThisComponent
Sheet = Doc.Sheets(0)
Cell = Sheet.getCellByPosition(0.0)  ' and next one with (0,1)

Select Case Cell.Type
   MsgBox "Content: Empty"
   MsgBox "Content: Value"
   MsgBox "Content: Text"
   MsgBox "Content: Formula"
End Select

I got result: text for the a1 and value for a2.

My questionis is How can I turn this value 3 from a2 into the astring, and not in basic IDE, but in the table (spreadsheet alone)- meaning, "from outside" the code.

many thanks!!!
Ricky G. Marion
Posts: 25
Joined: Mon Mar 24, 2014 6:33 am

Re: Issue in Sheet content: number to string !

Postby UniSET » Fri Sep 12, 2014 6:19 am


Did you consider using the TEXT() function ?
It's described in help. In such a simple case you may also use =""&A2. Changing the content type "in situ": Enter '3 ("3" with a single apostrophe prefixed). OR: Enter ="3". You may also set the fake number format code "@" in advance and then enter 3 without further precautions (not recommended by me).
To change the content type uniformly for a range which is a contiguous part of a column AFTER entering data use 'Data' > 'Text to Columns...'.

hope this will help you..
Posts: 22
Joined: Tue Mar 25, 2014 6:33 am

Return to Calc

Who is online

Users browsing this forum: No registered users and 1 guest