• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 348
  • Last Modified:

Excel VBA problem

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
linh-nguyen05
Asked:
linh-nguyen05
  • 2
1 Solution
 
yotamsherCommented:
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
 
linh-nguyen05Author Commented:
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
 
yotamsherCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now