REM ***** BASIC ***** 'By Michael E. Sherman 'With lots of help from the examples Andrew's Macro Information Sub SetFrontRim Dim oDocument As Object 'the spokecalc spreadsheet Dim oCalcSheet As Object 'the calculator sheet Dim oRimSheet As Object 'the rim selection sheet Dim oSelection As Object 'the selected area on the rim selection sheet Dim oCell As Object 'the selected cell on the calculator sheet Dim oRimCell As Object 'the selected cell on the rim selection sheet Dim RimRow As Integer oDocument=ThisComponent oCalcSheet=oDocument.Sheets.getByName("calculator") oRimSheet=oDocument.Sheets.getByName("rims") oSelection = ThisComponent.getCurrentSelection() 'If there's ONLY 1 cell selected If oSelection.supportsService("com.sun.star.sheet.SheetCell") Then 'Print "One Cell selected = " & oSelection.getImplementationName() 'MsgBox "getString() = " & oSelection.getString() 'Write the rim name to the calculator sheet oCell = oCalcSheet.getCellByPosition(2, 35) oCell.setString( oSelection.getString ) 'Where the selected name is RimRow=oSelection.CellAddress.Row 'Write the rim ERD to the calculator sheet oRimCell = oRimSheet.getCellByPosition(0, RimRow) oCell = oCalcSheet.getCellByPosition(2, 10) oCell.setValue( oRimCell.getValue ) 'Write the rim OSB to the calculator sheet oRimCell = oRimSheet.getCellByPosition(1, RimRow) oCell = oCalcSheet.getCellByPosition(2, 11) oCell.setValue( oRimCell.getValue ) End If End Sub Sub SetRearRim Dim oDocument As Object 'the spokecalc spreadsheet Dim oCalcSheet As Object 'the calculator sheet Dim oRimSheet As Object 'the rim selection sheet Dim oSelection As Object 'the selected area on the rim selection sheet Dim oCell As Object 'the selected cell on the calculator sheet Dim oRimCell As Object 'the selected cell on the rim selection sheet Dim RimRow As Integer oDocument=ThisComponent oCalcSheet=oDocument.Sheets.getByName("calculator") oRimSheet=oDocument.Sheets.getByName("rims") oSelection = ThisComponent.getCurrentSelection() 'If there's ONLY 1 cell selected If oSelection.supportsService("com.sun.star.sheet.SheetCell") Then 'Print "One Cell selected = " & oSelection.getImplementationName() 'MsgBox "getString() = " & oSelection.getString() 'Write the rim name to the calculator sheet oCell = oCalcSheet.getCellByPosition(2, 37) oCell.setString( oSelection.getString ) 'Where the selected name is RimRow=oSelection.CellAddress.Row 'Write the rim ERD to the calculator sheet oRimCell = oRimSheet.getCellByPosition(0, RimRow) oCell = oCalcSheet.getCellByPosition(2, 23) oCell.setValue( oRimCell.getValue ) 'Write the rim OSB to the calculator sheet oRimCell = oRimSheet.getCellByPosition(1, RimRow) oCell = oCalcSheet.getCellByPosition(2, 24) oCell.setValue( oRimCell.getValue ) End If End Sub Sub SetBothRims Dim oDocument As Object 'the spokecalc spreadsheet Dim oCalcSheet As Object 'the calculator sheet Dim oRimSheet As Object 'the rim selection sheet Dim oSelection As Object 'the selected area on the rim selection sheet Dim oCell As Object 'the selected cell on the calculator sheet Dim oRimCell As Object 'the selected cell on the rim selection sheet Dim RimRow As Integer oDocument=ThisComponent oCalcSheet=oDocument.Sheets.getByName("calculator") oRimSheet=oDocument.Sheets.getByName("rims") oSelection = ThisComponent.getCurrentSelection() 'If there's ONLY 1 cell selected If oSelection.supportsService("com.sun.star.sheet.SheetCell") Then 'Print "One Cell selected = " & oSelection.getImplementationName() 'MsgBox "getString() = " & oSelection.getString() 'Write the rim name to the calculator sheet oCell = oCalcSheet.getCellByPosition(2, 35) oCell.setString( oSelection.getString ) oCell = oCalcSheet.getCellByPosition(2, 37) oCell.setString( oSelection.getString ) 'Where the selected name is RimRow=oSelection.CellAddress.Row 'Write the rim ERD to the calculator sheet oRimCell = oRimSheet.getCellByPosition(0, RimRow) oCell = oCalcSheet.getCellByPosition(2, 10) oCell.setValue( oRimCell.getValue ) oCell = oCalcSheet.getCellByPosition(2, 23) oCell.setValue( oRimCell.getValue ) 'Write the rim OSB to the calculator sheet oRimCell = oRimSheet.getCellByPosition(1, RimRow) oCell = oCalcSheet.getCellByPosition(2, 11) oCell.setValue( oRimCell.getValue ) oCell = oCalcSheet.getCellByPosition(2, 24) oCell.setValue( oRimCell.getValue ) End If End Sub Sub SetFrontHub Dim oDocument As Object 'the spokecalc spreadsheet Dim oCalcSheet As Object 'the calculator sheet Dim oHubSheet As Object 'the Hub selection sheet Dim oSelection As Object 'the selected area on the rim selection sheet Dim oCell As Object 'the selected cell on the calculator sheet Dim oHubCell As Object 'the selected cell on the Hub selection sheet Dim HubRow As Integer oDocument=ThisComponent oCalcSheet=oDocument.Sheets.getByName("calculator") oHubSheet=oDocument.Sheets.getByName("hubs") oSelection = ThisComponent.getCurrentSelection() 'If there's ONLY 1 cell selected If oSelection.supportsService("com.sun.star.sheet.SheetCell") Then 'Print "One Cell selected = " & oSelection.getImplementationName() 'MsgBox "getString() = " & oSelection.getString() 'Write the Hub name to the calculator sheet oCell = oCalcSheet.getCellByPosition(2, 34) oCell.setString( oSelection.getString ) 'Where the selected name is HubRow=oSelection.CellAddress.Row 'Write the Spoke Hole Diameter to the calculator sheet oHubCell = oHubSheet.getCellByPosition(0, HubRow) 'print oHubCell.getValue oCell = oCalcSheet.getCellByPosition(2, 16) oCell.setValue( oHubCell.getValue ) 'Write the Hub Left Diameter to the calculator sheet oHubCell = oHubSheet.getCellByPosition(1, HubRow) oCell = oCalcSheet.getCellByPosition(2, 14) oCell.setValue( oHubCell.getValue ) 'Write the Hub Left Width to the calculator sheet oHubCell = oHubSheet.getCellByPosition(2, HubRow) oCell = oCalcSheet.getCellByPosition(2, 12) oCell.setValue( oHubCell.getValue ) 'Write the Hub Right Diameter to the calculator sheet oHubCell = oHubSheet.getCellByPosition(3, HubRow) oCell = oCalcSheet.getCellByPosition(2, 15) oCell.setValue( oHubCell.getValue ) 'Write the Hub Right Width to the calculator sheet oHubCell = oHubSheet.getCellByPosition(4, HubRow) oCell = oCalcSheet.getCellByPosition(2, 13) oCell.setValue( oHubCell.getValue ) End If End Sub Sub SetRearHub Dim oDocument As Object 'the spokecalc spreadsheet Dim oCalcSheet As Object 'the calculator sheet Dim oHubSheet As Object 'the Hub selection sheet Dim oSelection As Object 'the selected area on the rim selection sheet Dim oCell As Object 'the selected cell on the calculator sheet Dim oHubCell As Object 'the selected cell on the Hub selection sheet Dim HubRow As Integer oDocument=ThisComponent oCalcSheet=oDocument.Sheets.getByName("calculator") oHubSheet=oDocument.Sheets.getByName("hubs") oSelection = ThisComponent.getCurrentSelection() 'If there's ONLY 1 cell selected If oSelection.supportsService("com.sun.star.sheet.SheetCell") Then 'Print "One Cell selected = " & oSelection.getImplementationName() 'MsgBox "getString() = " & oSelection.getString() 'Write the Hub name to the calculator sheet oCell = oCalcSheet.getCellByPosition(2, 36) oCell.setString( oSelection.getString ) 'Where the selected name is HubRow=oSelection.CellAddress.Row 'Write the Spoke Hole Diameter to the calculator sheet oHubCell = oHubSheet.getCellByPosition(0, HubRow) oCell = oCalcSheet.getCellByPosition(2, 29) oCell.setValue( oHubCell.getValue ) 'Write the Hub Left Diameter to the calculator sheet oHubCell = oHubSheet.getCellByPosition(1, HubRow) oCell = oCalcSheet.getCellByPosition(2, 27) oCell.setValue( oHubCell.getValue ) 'Write the Hub Left Width to the calculator sheet oHubCell = oHubSheet.getCellByPosition(2, HubRow) oCell = oCalcSheet.getCellByPosition(2, 25) oCell.setValue( oHubCell.getValue ) 'Write the Hub Right Diameter to the calculator sheet oHubCell = oHubSheet.getCellByPosition(3, HubRow) oCell = oCalcSheet.getCellByPosition(2, 28) oCell.setValue( oHubCell.getValue ) 'Write the Hub Right Width to the calculator sheet oHubCell = oHubSheet.getCellByPosition(4, HubRow) oCell = oCalcSheet.getCellByPosition(2, 26) oCell.setValue( oHubCell.getValue ) End If End Sub