| View previous topic :: View next topic |
| Author |
Message |
jerd4k Newbie

Joined: 28 Apr 2012 Posts: 2
|
Posted: Sat Apr 28, 2012 10:50 am Post subject: Select individual cells have their content combined in 1? |
|
|
I'm new in Open Office after getting a tip this program might do the trick I'm looking for.
How can I create a program so I can select individual cells and see their combined content (words) in one (preselected) cell? And make it as simply, easy and efficient to use as possible:)
The goal is to quickly, easily and efficiently combine words from different wordstacks into one sentence without any typing just mouse clicking.
Your knowledge is greatly appreciated.
Last edited by jerd4k on Mon Apr 30, 2012 9:31 pm; edited 1 time in total |
|
| Back to top |
|
 |
patel Power User

Joined: 14 Apr 2012 Posts: 54 Location: Italy
|
Posted: Mon Apr 30, 2012 8:13 pm Post subject: |
|
|
wath's the goal ? _________________ If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button). |
|
| Back to top |
|
 |
jerd4k Newbie

Joined: 28 Apr 2012 Posts: 2
|
Posted: Mon Apr 30, 2012 9:30 pm Post subject: |
|
|
Hi Patel,
The goal is to quickly, easily and efficiently combine words from different wordstacks into one sentence without any typing just mouse clicking.
How can this be done with OpenOffice? |
|
| Back to top |
|
 |
patel Power User

Joined: 14 Apr 2012 Posts: 54 Location: Italy
|
Posted: Tue May 01, 2012 3:19 am Post subject: |
|
|
can you solve it with Excel VBA ? just to have an example. _________________ If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button). |
|
| Back to top |
|
 |
patel Power User

Joined: 14 Apr 2012 Posts: 54 Location: Italy
|
Posted: Thu May 03, 2012 1:16 am Post subject: |
|
|
| Code: | REM ***** BASIC *****
Dim s As String
Sub GetSelectedCells()
Dim oSelections, oCell, oRanges, i As Long
Doc = ThisComponent
Sheet = Doc.Sheets(0)
oSelections = Doc.getCurrentSelection()
If IsNull(oSelections) Then Exit Sub
If oSelections.supportsService("com.sun.star.sheet.SheetCell") Then
oCell = oSelections
s = s & oCell.getString() & " "
ElseIf oSelections.supportsService("com.sun.star.sheet.SheetCellRange") Then
GetRangeText(oSelections)
ElseIf oSelections.supportsService("com.sun.star.sheet.SheetCellRanges") Then
oRanges = oSelections
For i = 0 To oRanges.getCount() - 1
GetRangeText(oRanges.getByIndex(i))
Next
End If
Sheet.getCellRangeByName("D3").string = s
End Sub
Sub GetRangeText(oRange)
Dim nCol As Long, nRow As Long, oCols, oRows
oCols = oRange.Columns
oRows = oRange.Rows
For nCol = 0 To oCols.getCount() - 1
For nRow = 0 To oRows.getCount() - 1
a=oRange.getCellByPosition(nCol, nRow).getString()
s = s & a & " "
Next
Next
End Sub |
wit Excel Vba
| Code: | Public Sub copypaste()
Dim c As Range
Dim s As String
For Each c In Selection
s = s & c.Value & " "
Next
Cells(3, 4).Value = s 'Trim(s)
Set c = Nothing
End Sub |
_________________ If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button). |
|
| Back to top |
|
 |
|