Solved

Excel VBA problem

Posted on 2006-07-15
5
308 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
ID: 17114426
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
ID: 17116038
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
ID: 17116943
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
noX challenge 17 92
array11 challenge 16 60
why my code login on a web site with access vba don't work on microsoft access 2016 26 58
program a usb light to turn on when needed 6 49
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

920 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

15 Experts available now in Live!

Get 1:1 Help Now