Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA 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 June 7th, 2006, 10:30 PM
Authorized User
 
Join Date: Jan 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default ComboBox & Named Range

I use a Combobox Control with a list of named ranges in the dropdown-list to access the relevant range within an active workbook.
 However, when the namedranges are outside the sheet where the ComboBox is embedded, for example in accessing a named range in sheet3, an error message is displayed:
     "Run-time error '1004'
     Method 'Range' of object 'Worksheet' failed"

  Is there any guru out there to correct/add codes to the following to enable the named ranges in other sheets to be open and selected?
   Here is the code :

 Private Sub ComboBox1_Click()
Range(ComboBox1.Value).Activate

End Sub


 
Old June 9th, 2006, 01:00 PM
Authorized User
 
Join Date: Mar 2006
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Private Sub ComboBox1_Change()

    Application.Goto Reference:=ComboBox1.Value

End Sub

 
Old June 13th, 2006, 12:59 PM
Authorized User
 
Join Date: Jan 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by jrogers
 Private Sub ComboBox1_Change()

    Application.Goto Reference:=ComboBox1.Value

End Sub

Thanks , Jason.
The codes could not work very well initially, when I return to the Sheet where the Combobox resides.
  However, by changing the "change" event to "Click" for the Combobox, it works wonderfully!

 Private Sub Combobox1_Click()

  Application.Goto Reference:=Combobox1.value

 End Sub


   





Similar Threads
Thread Thread Starter Forum Replies Last Post
Combobox List Fill Range jani Access VBA 1 July 29th, 2008 05:04 PM
Using month & year variable to get date in range rsearing ASP.NET 2.0 Professional 2 July 5th, 2008 08:30 AM
Increment By Range & Output Solver Result ibrahim ahmad Excel VBA 0 April 30th, 2008 10:16 PM
Named Range and Combobox bahachin Excel VBA 5 November 23rd, 2006 01:16 PM





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