PC Review


Reply
Thread Tools Rate Thread

Depositing ListBox Values Into Active Cell?

 
 
Daystrom
Guest
Posts: n/a
 
      20th Feb 2009
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 With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      20th Feb 2009
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
<(E-Mail Removed)> 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 With Quote
 
Daystrom
Guest
Posts: n/a
 
      21st Feb 2009
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
> <(E-Mail Removed)> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Email depositing in with other emails Rj Windows Vista Mail 4 12th May 2009 12:03 PM
Macro won't work in a form depositing info into another table =?Utf-8?B?V2FsdGVyIEJyb25lcg==?= Microsoft Access Form Coding 9 4th Jun 2007 03:53 PM
Listbox: Insert multiple values selected from listbox into databas =?Utf-8?B?QmFudQ==?= Microsoft VB .NET 0 5th Oct 2006 01:56 PM
All selected listbox values to a cell? HK Microsoft Excel Programming 1 11th Apr 2006 12:06 PM
Moving cell values from sheet2 to sheet1 using UserForms and ListBox Stein Kristiansen Microsoft Excel Programming 0 20th Nov 2003 07:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:36 AM.