Solved

Excel VBA problem

Posted on 2006-07-15
5
336 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
[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
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
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…
Progress

688 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