importing excel file to hp prime
|
12-31-2018, 01:38 PM
Post: #16
|
|||
|
|||
RE: importing excel file to hp prime
These are wise words that I'll pay attention to. My only reason for wanting to port spreadsheets from, say, Excel, to the Prime, is because I developed them there first. I certainly don't see this as my primary spreadsheet tool.
Nonetheless, I finished writing this VB macro...I offer it without any guarantees, but it worked for me in Windows 10 Pro x64, Excel 2010, CK 2.1.14181 Prime VC Sub Convert_Excel_To_CK_in_HP_Prime_VC_format() 'This was tested using algebraic RPN mode in CK 2.1.14181 Prime VC, 2012-12-30 'I could not paste directly to the Prime VC...it crashed. 'NOTE: After pasting your spreadsheet into this one, the range will be selected. 'Show formulas. 'Run this macro. 'Copy the selected range, and paste into appropriate cell in the CK. Dim rowMax, colMax As Long Const vbDoubleQuote As String = """" 'represents 1 double quote (") Const vbSingleQuote As String = "'" 'represents 1 single quote (') 'Read the row,col of the last UsedRange cell rowMax = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row colMax = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Column cellstr = "" For i = 1 To rowMax For j = 1 To colMax If TypeName(ActiveSheet.Cells(i, j).Value) = "String" Then cellstr = vbDoubleQuote & vbDoubleQuote & vbDoubleQuote cellstr = cellstr & ActiveSheet.Cells(i, j).Value cellstr = cellstr & vbDoubleQuote & vbDoubleQuote & vbDoubleQuote ActiveSheet.Cells(i, j).Value = cellstr End If 'testing... 'In algebraic mode, with B1=6: 'Edit CK and insert [C1:3]: =B1 and 'B1' work; '=B1' does not 'Copying these cells from Excel 2010, pasting into CK, =B1 displays in CK and Prime VC 'In RPN mode, with B1=6: 'Edit CK and insert [C1:3]: =B1 and 'B1' work; '=B1' does not 'Copying these cells from Excel 2010, pasting into CK, =B1 displays in CK and BUT DOES NOT APPEAR in Prime VC 'This seems to work for algebraic and RPN, 2018-12-30 If ActiveSheet.Cells(i, j).HasFormula Then cellstr = ActiveSheet.Cells(i, j).Formula cellstr = Right(cellstr, Len(cellstr) - 1) cellstr = vbDoubleQuote & vbSingleQuote & cellstr & vbSingleQuote & vbDoubleQuote ActiveSheet.Cells(i, j).Value = cellstr End If Next Next End Sub |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)