Wrox Programmer Forums
|
BOOK: Excel 2000/2002 VBA Programmer's Reference
This is the forum to discuss the Wrox book Excel 2000 VBA: Programmers Reference by John Green, Stephen Bullen, Felipe Martins, Brian Johnson; ISBN: 9780764544019
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Excel 2000/2002 VBA Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 16th, 2004, 08:55 PM
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Excel 2000 VBA - Drop Down

How do you find the DropDown object in the Object Browser. I couldn't find it. Has anybody tried the DropDown Event on Page 177 of Excel 2000 VBA Programmers Reference. I can't seem to get it to work.

Thanks in advance.

 
Old May 18th, 2004, 12:34 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 124
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Are you getting error messages or is the drop down not appearing?

XUMUSKIEFAN
Wrox Moderator
 
Old July 7th, 2004, 06:22 PM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I'm also having troubles with this code. It doesn't run due to bugs. The debugger appears.

Do you have any clue?

Thanks,

Roberto.

 
Old July 10th, 2004, 09:53 AM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I just realized it was my mistake. I have just tried this code and it does work.

I changed the example a little bit to make sure international users can take advantage of it.

Cheers !

Sub AddDropDown(Target As Range)

Dim ddBox As DropDown

Dim vaProducts As Variant
Dim i As Integer

Dim streamSheet As Worksheet
Set streamSheet = Worksheets(2)

vaProducts = Array("Water", "Oil", "Chemicals", "Gas")


    Set ddBox = streamSheet.DropDowns.Add(Target.Left, Target.Top, Target.Width, Target.Height)


With ddBox
    .OnAction = "EnterProdinfo"
    For i = LBound(vaProducts) To UBound(vaProducts)
        .AddItem vaProducts(i)
    Next i
End With
End Sub

Private Sub EnterProdInfo()

Dim vaPrices As Variant
Dim streamSheet As Worksheet
Set streamSheet = Worksheets(2)

vaPrices = Array(15, 12.5, 20, 18)

    With streamSheet.DropDowns(Application.Caller)

        .TopLeftCell.Value = .List(.ListIndex)
        .TopLeftCell.Offset(0, 2).Value = vaPrices(.ListIndex - Array(0, 1)(1))
        .Delete
    End With


End Sub







Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2000 Create PDF with VBA [email protected] Excel VBA 8 March 5th, 2008 03:36 PM
drop Oracle table from VBA excel reipereira VB Databases Basics 0 February 2nd, 2006 01:01 PM
Excel 2000 VBA Problems drsammyb Excel VBA 0 January 17th, 2005 11:41 AM
VBA for Excel 2000...HELP! lhardesty Excel VBA 2 August 20th, 2004 09:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.