Search This Blog

23 August 2011

Open Office Star Basic macro to select sheet and write a summary to cells in different sheet


open office




REM ***** BASIC *****

Sub summary_odf()
' Author : Prasad Sirinayake
' Date : 19/08/2011

Dim oSheet1 as Object, oCell1 as Object, oDoc as Object
Dim oSheet as Object, oCel as Object

oDoc = ThisComponent

oSheet1 = oDoc.getSheets().getByName( "Sheet1" )
oCell1 = oSheet1.getCellRangeByName("a4")
ThisComponent.CurrentController.select(oCell1)

oAddress1 = oCell1.getCellAddress()
oCol1 = oAddress1.column
oRow1 = oAddress1.row

oSheet = oDoc.getSheets().getByName( "salaries" )
oCell = oSheet.getCellRangeByName("A6")
ThisComponent.CurrentController.select(oCell)

oAddress = oCell.getCellAddress()
oCol = oAddress.column
oRow = oAddress.row

Do While oCell.String <> ""

branch = oCell.String
if trim(oSheet.getCellByPosition(oCol+1,oRow+2).String) = "GENERAL SALES" then
gensale = trim(oSheet.getCellByPosition(oCol+1,oRow+5).Value)
endif
if trim(oSheet.getCellByPosition(oCol+2,oRow+2).String) = "LIFE SALES" then
lifesale = trim(oSheet.getCellByPosition(oCol+2,oRow+5).Value)
endif
if trim(oSheet.getCellByPosition(oCol+3,oRow+2).String) = "Others" then
others = trim(oSheet.getCellByPosition(oCol+3,oRow+5).Value)
endif
' Sheets("salaries").Select

ThisComponent.CurrentController.select("sheet1")

oCell1.String = branch
oCell1 = oSheet1.getCellByPosition(oCol1+1,oRow1)
oCell1.Value = gensale
oCell1 = oSheet1.getCellByPosition(oCol1+2,oRow1)
oCell1.Value = lifesale
oCell1 = oSheet1.getCellByPosition(oCol1+3,oRow1)
oCell1.Value = others
oRow1 = oRow1 + 1
oCell1 = oSheet1.getCellByPosition(oCol1,oRow1)

ThisComponent.CurrentController.select("salaries")

oRow = oRow + 9
oCell = oSheet.getCellByPosition(oCol,oRow)

gensale = 0
lifesale = 0
others = 0

loop

oCell1 = oSheet1.getCellRangeByName("a4")
ThisComponent.CurrentController.select(oCell1)

MsgBox "Macro Completed "
End Sub

08 August 2011

10 Useful Application Indicators for Ubuntu 11.04 Natty Narwhal

URL
10 Useful Application Indicators for Ubuntu 11.04 Natty Narwhal | Tech Drive-in

System Load Indicator

System Load Application Indicator Ubuntu 11.04
  • System Load Indicator is a simple network, memory and CPU usage indicator which is actually a port of the original System Monitor GNOME Panel applet.
  • Do the following in Terminal to install System Load Indicator in Ubuntu 11.04.
sudo add-apt-repository ppa:indicator-multiload/stable-daily sudo apt-get update sudo apt-get install indicator-multiload
  • Done. And simply launch System Load Indicator from Unity dash. Eventhough System Load Indicator app is equally good, I prefer Sysmonitor Indicator for its simplicity.

How to Organize Virtual DJ Music Library using Shazam

  How to Organize Virtual DJ Music Library using Shazam Please Visit our YouTube channel and view our video on  following Video Link 1 Maste...