Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Depositing ListBox Values Into Active Cell?

Probably this is a stupid question, but the closest answer I can find
anywhere is Debra Dagleish's code that allows for consecutive selections from
a data-validation dropdown to be entered in a cell, separated by commas. For
a few reasons I'd rather do something with a ListBox in a UserForm.

On the UserForm is a ListBox (called ListBox2) which can contain any number
of items. When a user clicks a button on the UserForm, is it possible to have
those items, separated by commas, deposited into the Active Cell on the
current worksheet?

If anyone could help, I'd really appreciate it. I keep finding close
alternatives to what I need, but nothing that quite hits it, and I'm clearly
I'm just not smart enough to do this.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Depositing ListBox Values Into Active Cell?

Try


Private Sub CommandButton2_Click()
Dim N As Long
Dim S As String
With Me.ListBox1
If .ListCount = 0 Then
Exit Sub
End If
For N = 0 To .ListCount - 1
S = S & .List(N) & ","
Next N
End With
S = Mid(S, 1, Len(S) - 1)
ActiveCell.Value = S
End Sub



Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Fri, 20 Feb 2009 12:26:01 -0800, Daystrom
wrote:

Probably this is a stupid question, but the closest answer I can find
anywhere is Debra Dagleish's code that allows for consecutive selections from
a data-validation dropdown to be entered in a cell, separated by commas. For
a few reasons I'd rather do something with a ListBox in a UserForm.

On the UserForm is a ListBox (called ListBox2) which can contain any number
of items. When a user clicks a button on the UserForm, is it possible to have
those items, separated by commas, deposited into the Active Cell on the
current worksheet?

If anyone could help, I'd really appreciate it. I keep finding close
alternatives to what I need, but nothing that quite hits it, and I'm clearly
I'm just not smart enough to do this.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Depositing ListBox Values Into Active Cell?

You're a god, Chip! It works perfectly--thank you so much! Sorry about the
slow replay, but I had to leave work early yesterday to visit (horribly) with
my parents in law, so I just saw this. You've made this whole weekend much
better. Again, thank you!

"Chip Pearson" wrote:

Try


Private Sub CommandButton2_Click()
Dim N As Long
Dim S As String
With Me.ListBox1
If .ListCount = 0 Then
Exit Sub
End If
For N = 0 To .ListCount - 1
S = S & .List(N) & ","
Next N
End With
S = Mid(S, 1, Len(S) - 1)
ActiveCell.Value = S
End Sub



Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Fri, 20 Feb 2009 12:26:01 -0800, Daystrom
wrote:

Probably this is a stupid question, but the closest answer I can find
anywhere is Debra Dagleish's code that allows for consecutive selections from
a data-validation dropdown to be entered in a cell, separated by commas. For
a few reasons I'd rather do something with a ListBox in a UserForm.

On the UserForm is a ListBox (called ListBox2) which can contain any number
of items. When a user clicks a button on the UserForm, is it possible to have
those items, separated by commas, deposited into the Active Cell on the
current worksheet?

If anyone could help, I'd really appreciate it. I keep finding close
alternatives to what I need, but nothing that quite hits it, and I'm clearly
I'm just not smart enough to do this.


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
bind data to active x listbox without macro Ram Excel Discussion (Misc queries) 0 September 11th 06 07:46 PM
All selected listbox values to a cell? HK[_4_] Excel Programming 1 April 11th 06 12:06 PM
Userform Listbox using an active sheet [email protected] Excel Discussion (Misc queries) 0 March 1st 06 08:22 PM
Multiselect ListBox - Active/Inactive Items LCK[_2_] Excel Programming 2 November 3rd 05 12:39 AM
Moving cell values from sheet2 to sheet1 using UserForms and ListBox Stein Kristiansen Excel Programming 0 November 20th 03 07:13 AM


All times are GMT +1. The time now is 04:56 PM.

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

About Us

"It's about Microsoft Excel"