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
Solved

Excel VBA problem

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Title # Comments Views Activity
Tviruailstringtree sort multi columns on header click 1 74
ejb example issues 3 25
collection output issue 9 36
Do Wend Macro not working 22 34
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
This is about my first experience with programming Arduino.

856 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