Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro for using multiple selected cells

Hi! I have no experience with programming macros so bear with me. I'm not
sure if my case is possible to do in some easy way.

I want the user to be able to select some cells in a coulmn Users in a
worksheet. This selection will then be concatenated to a string of Usernaes
and inserted in a user-selected cell in another worksheet.

--
OTS
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Macro for using multiple selected cells

Hi
This will put your string on sheet "mydata" in cell "A1". The selected
cells can be anywhere on the active sheet, and you would need further
error checking if you want to restrict people to one particular
column. Names will be seperated by commas, but you can change this
below. you will get an error if no cells are selected.

Sub tester3()
Dim Cell As Range
Dim mystring As String
For Each Cell In SelectedRange
mystring = mystring & ", " & Cell.Text
Next Cell
'take off leading 2 characters ", "
mystring = Right(mystring, Len(mystring) - 2)
Worksheets("mydata").Range("a1").Value = mystring

End Sub

regards
Paul

On May 11, 9:24 am, OTS wrote:
Hi! I have no experience with programming macros so bear with me. I'm not
sure if my case is possible to do in some easy way.

I want the user to be able to select some cells in a coulmn Users in a
worksheet. This selection will then be concatenated to a string of Usernaes
and inserted in a user-selected cell in another worksheet.

--
OTS



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Macro for using multiple selected cells

Hi ! I have made a litlle programm fpr your problem.
Create a button and write code like you see here in the modul:

Sub Button1_Click()

Dim oData As New DataObject
Dim sText As String

For Each cell In Selection.Cells
On Error Resume Next 'ignore all errors
sText = sText & CStr(cell.Value) & " "
Next cell

oData.SetText sText
oData.PutInClipboard

End Sub

It takes the selected cells, convert them to a string and write this string
in the clipbboard. Then you can past it where ever you want.



"OTS" wrote:

Hi! I have no experience with programming macros so bear with me. I'm not
sure if my case is possible to do in some easy way.

I want the user to be able to select some cells in a coulmn Users in a
worksheet. This selection will then be concatenated to a string of Usernaes
and inserted in a user-selected cell in another worksheet.

--
OTS

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro for using multiple selected cells

Great!
I just changes "SelectedRange" to Selecteion and it worked like a dream.
Now I guess I have to do some error cheking so that I can be sure that the
Cell values come from the desired column.

Thanks man!

Regards
OTS

" wrote:

Hi
This will put your string on sheet "mydata" in cell "A1". The selected
cells can be anywhere on the active sheet, and you would need further
error checking if you want to restrict people to one particular
column. Names will be seperated by commas, but you can change this
below. you will get an error if no cells are selected.

Sub tester3()
Dim Cell As Range
Dim mystring As String
For Each Cell In SelectedRange
mystring = mystring & ", " & Cell.Text
Next Cell
'take off leading 2 characters ", "
mystring = Right(mystring, Len(mystring) - 2)
Worksheets("mydata").Range("a1").Value = mystring

End Sub

regards
Paul

On May 11, 9:24 am, OTS wrote:
Hi! I have no experience with programming macros so bear with me. I'm not
sure if my case is possible to do in some easy way.

I want the user to be able to select some cells in a coulmn Users in a
worksheet. This selection will then be concatenated to a string of Usernaes
and inserted in a user-selected cell in another worksheet.

--
OTS




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Macro for using multiple selected cells

Sorry, I've not seen the last answer ....

"Michi" wrote:

Hi ! I have made a litlle programm fpr your problem.
Create a button and write code like you see here in the modul:

Sub Button1_Click()

Dim oData As New DataObject
Dim sText As String

For Each cell In Selection.Cells
On Error Resume Next 'ignore all errors
sText = sText & CStr(cell.Value) & " "
Next cell

oData.SetText sText
oData.PutInClipboard

End Sub

It takes the selected cells, convert them to a string and write this string
in the clipbboard. Then you can past it where ever you want.



"OTS" wrote:

Hi! I have no experience with programming macros so bear with me. I'm not
sure if my case is possible to do in some easy way.

I want the user to be able to select some cells in a coulmn Users in a
worksheet. This selection will then be concatenated to a string of Usernaes
and inserted in a user-selected cell in another worksheet.

--
OTS



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro for using multiple selected cells

Thanks man. I'll give it a try. :-)

Regards
OTS

"Michi" wrote:

Hi ! I have made a litlle programm fpr your problem.
Create a button and write code like you see here in the modul:

Sub Button1_Click()

Dim oData As New DataObject
Dim sText As String

For Each cell In Selection.Cells
On Error Resume Next 'ignore all errors
sText = sText & CStr(cell.Value) & " "
Next cell

oData.SetText sText
oData.PutInClipboard

End Sub

It takes the selected cells, convert them to a string and write this string
in the clipbboard. Then you can past it where ever you want.



"OTS" wrote:

Hi! I have no experience with programming macros so bear with me. I'm not
sure if my case is possible to do in some easy way.

I want the user to be able to select some cells in a coulmn Users in a
worksheet. This selection will then be concatenated to a string of Usernaes
and inserted in a user-selected cell in another worksheet.

--
OTS

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Macro for using multiple selected cells

On May 11, 1:49 pm, OTS wrote:
Great!
I just changes "SelectedRange" to Selecteion and it worked like a dream.
Now I guess I have to do some error cheking so that I can be sure that the
Cell values come from the desired column.

Thanks man!

Regards
OTS



" wrote:
Hi
This will put your string on sheet "mydata" in cell "A1". The selected
cells can be anywhere on the active sheet, and you would need further
error checking if you want to restrict people to one particular
column. Names will be seperated by commas, but you can change this
below. you will get an error if no cells are selected.


Sub tester3()
Dim Cell As Range
Dim mystring As String
For Each Cell In SelectedRange
mystring = mystring & ", " & Cell.Text
Next Cell
'take off leading 2 characters ", "
mystring = Right(mystring, Len(mystring) - 2)
Worksheets("mydata").Range("a1").Value = mystring


End Sub


regards
Paul

oops, sorry about that, I pasted one I was working on - selection is
right.
Paul

On May 11, 9:24 am, OTS wrote:
Hi! I have no experience with programming macros so bear with me. I'm not
sure if my case is possible to do in some easy way.


I want the user to be able to select some cells in a coulmn Users in a
worksheet. This selection will then be concatenated to a string of Usernaes
and inserted in a user-selected cell in another worksheet.


--
OTS- Hide quoted text -


- Show quoted text -



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro for using multiple selected cells

No prob. I guess your approach is somewhat better since I can use it for
severel other tasks. I have tried it, but the "new DataObject" dosent seem to
work. I guess it is my lack of knowledge on this subject that dosen't get it
to work though..

Regards
OTS

"Michi" wrote:

Sorry, I've not seen the last answer ....

"Michi" wrote:

Hi ! I have made a litlle programm fpr your problem.
Create a button and write code like you see here in the modul:

Sub Button1_Click()

Dim oData As New DataObject
Dim sText As String

For Each cell In Selection.Cells
On Error Resume Next 'ignore all errors
sText = sText & CStr(cell.Value) & " "
Next cell

oData.SetText sText
oData.PutInClipboard

End Sub

It takes the selected cells, convert them to a string and write this string
in the clipbboard. Then you can past it where ever you want.



"OTS" wrote:

Hi! I have no experience with programming macros so bear with me. I'm not
sure if my case is possible to do in some easy way.

I want the user to be able to select some cells in a coulmn Users in a
worksheet. This selection will then be concatenated to a string of Usernaes
and inserted in a user-selected cell in another worksheet.

--
OTS

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop multiple cells from being automatically selected JDandLinda Excel Discussion (Misc queries) 1 January 17th 10 06:31 PM
why are multiple cells selected when i only want one? cherylwales Excel Discussion (Misc queries) 5 December 8th 09 11:30 PM
Multiple cells or columns are selected instead of selected cell or Mikey Excel Discussion (Misc queries) 1 April 29th 09 09:48 PM
why do multiple cells get selected when i click only one cell? Colie Excel Discussion (Misc queries) 8 October 13th 08 04:47 PM
Macro to take selected cells times a selected cell Craig Excel Programming 4 October 24th 05 12:54 AM


All times are GMT +1. The time now is 11:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"