Solved

Sending data from List Box

Posted on 2012-03-22
2
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

751 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