OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Select individual cells have their content combined in 1?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
jerd4k
Newbie
Newbie


Joined: 28 Apr 2012
Posts: 2

PostPosted: Sat Apr 28, 2012 10:50 am    Post subject: Select individual cells have their content combined in 1? Reply with quote

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
View user's profile Send private message
patel
Power User
Power User


Joined: 14 Apr 2012
Posts: 54
Location: Italy

PostPosted: Mon Apr 30, 2012 8:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
jerd4k
Newbie
Newbie


Joined: 28 Apr 2012
Posts: 2

PostPosted: Mon Apr 30, 2012 9:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
patel
Power User
Power User


Joined: 14 Apr 2012
Posts: 54
Location: Italy

PostPosted: Tue May 01, 2012 3:19 am    Post subject: Reply with quote

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
View user's profile Send private message
patel
Power User
Power User


Joined: 14 Apr 2012
Posts: 54
Location: Italy

PostPosted: Thu May 03, 2012 1:16 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group