Solved

Excel VBA problem

Posted on 2006-07-15
5
296 Views
Last Modified: 2011-09-20
Hi,

I need help. I develop a small application using Excel VBA, in user form I have 1 list box and 2 buttons (OK and EXIT).When user select one item or more in list box and click OK. It will generate to another worksheet and display details of items in that sheet.

For example,
list box have item1,item2,item3. Each of them have item number, item name...item number is in list box. So user select item1 and click OK. A new sheet display and item number with matching name in cells.

My question is how to make these things work. Note: I am working with form.

thanks  
0
Comment
Question by:linh-nguyen05
  • 2
5 Comments
 
LVL 7

Expert Comment

by:yotamsher
Comment Utility
when you say another worksheet do you mean to create it in another workbook?
is the list being populated from the worksheet?
where exactly is your problem ( the whole concept?, the creation of another sheet? ...)
0
 

Author Comment

by:linh-nguyen05
Comment Utility
Hi yotamsher,

another worksheet in the same workbook because the existing worksheet have original data in it. The list is created on the form. I want codes to display item details in new worksheet of the same workbook.

Thanks
0
 
LVL 7

Accepted Solution

by:
yotamsher earned 125 total points
Comment Utility
ok here is a start:
the following code, is taking the clicked value in the listbox, and inserting it in the Worksheet called Sheet2 (you can also access the sheet by index), the value is inserted at the first column, each time in a new row

Dim ws As Worksheet
Set ws = Worksheets.Item("sheet2")
ws.Cells(CurrentRow, 1) = ListBox1.Value
CurrentRow = CurrentRow + 1

offcourse CurrentRow is decalred in the global area, and set to zero in form initialize.

to get some more complicated results, you might need to know the Range object
if you need more assistance, please comment again

Yotam
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

762 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

11 Experts available now in Live!

Get 1:1 Help Now