Solved

Sending data from List Box

Posted on 2012-03-22
2
190 Views
Last Modified: 2012-03-22
Hi, i have a piece of code that sends data from a list box in one excel workbook to a sheet in another excel workbook.

The code is below

The problem is it sends all entries from the listbox whereas i only want it to send the item that has been selected by the user

How can i achieve this?

Thanks
Seamus


Private Sub SendingData_Click()
Dim NextCell As Range
Dim arrList



     Set NextCell = Workbooks("Match.xls").Worksheets("Mapping Table").Range("B" & Rows.Count).End(xlUp).Offset(1)

      arrList = ListBox2.List

     NextCell.Resize(UBound(arrList)).value = arrList
End Sub
0
Comment
Question by:Seamus2626
2 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 37751772
If it's a single select listbox, then it's just:

Private Sub SendingData_Click()
Dim NextCell As Range
Dim arrList



     Set NextCell = Workbooks("Match.xls").Worksheets("Mapping Table").Range("B" & Rows.Count).End(xlUp).Offset(1)

     NextCell.value = Listbox2.Value
End Sub

Open in new window

0
 

Author Closing Comment

by:Seamus2626
ID: 37751892
Cheers Rory!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now