Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default ComboBox and rowsource from an external sheet

Hello,
I'm trying to fill a combo box from a column of names in another
workbook. Here's what I have:

menu.ComboBox1.RowSource = "'C:\[data.xls]'!A1:A100"

This appears to be correct. I get an error code 380 - could not set
row source property. Can someone tell me what is wrong with this
code?

thanks,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ComboBox and rowsource from an external sheet


You are missing a sheet name


from
"'C:\[data.xls]'!A1:A100"


to
"'C:\[data.xls]sheet1'!A1:A100"


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=186101

Excel Live Chat

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default ComboBox and rowsource from an external sheet

First, you'll have to open the data.xls workbook.

Then you can use:

Dim myRng as range

with workbooks("data.xls").worksheets("youdidn'tgivethe name!")
set myrng = .range("a1:A10")
end with
....more code...
menu.combobox1.rowsource = myrng.address(external:=true)

Or if you want to close that data.xls workbook, you could just plop the values
from the range into the combobox.

menu.combobox1.list = myrng.value



Andrew wrote:

Hello,
I'm trying to fill a combo box from a column of names in another
workbook. Here's what I have:

menu.ComboBox1.RowSource = "'C:\[data.xls]'!A1:A100"

This appears to be correct. I get an error code 380 - could not set
row source property. Can someone tell me what is wrong with this
code?

thanks,


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default ComboBox and rowsource from an external sheet

Hi Andrew,

'[Data.xls]Sheet1'!A1:A100

It appears that Data.xls needs to be open to use it as the Rowsource for the
Combo Box.

You can get the syntax for stuff like that by selecting an empty cell in
your workbook and enter = and then select the workbook and then the range and
press Enter. Then just select the formula in the formula bar and copy, press
enter or Esc to get out of the formula bar and paste it into the RowSource.

You might be better to make a range in the workbook with the ComboBox equal
to the range in Data.xls and then use the range in the workbook. That way
Data.xls does not need to be open.


--
Regards,

OssieMac


"Andrew" wrote:

Hello,
I'm trying to fill a combo box from a column of names in another
workbook. Here's what I have:

menu.ComboBox1.RowSource = "'C:\[data.xls]'!A1:A100"

This appears to be correct. I get an error code 380 - could not set
row source property. Can someone tell me what is wrong with this
code?

thanks,
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default ComboBox and rowsource from an external sheet

On Mar 9, 4:35*pm, OssieMac
wrote:
Hi Andrew,

'[Data.xls]Sheet1'!A1:A100

It appears that Data.xls needs to be open to use it as the Rowsource for the
Combo Box.

You can get the syntax for stuff like that by selecting an empty cell in
your workbook and enter = and then select the workbook and then the range and
press Enter. Then just select the formula in the formula bar and copy, press
enter or Esc to get out of the formula bar and paste it into the RowSource.

You might be better to make a range in the workbook with the ComboBox equal
to the range in Data.xls and then use the range in the workbook. That way
Data.xls does not need to be open.

--
Regards,

OssieMac

"Andrew" wrote:
Hello,
I'm trying to fill a combo box from a column of names in another
workbook. *Here's what I have:


menu.ComboBox1.RowSource = "'C:\[data.xls]'!A1:A100"


This appears to be correct. *I get an error code 380 - could not set
row source property. *Can someone tell me what is wrong with this
code?


thanks,
.


Thanks for your help on the sheet name. But if I use a range then I
can simply call the information from another sheet without having to
open the other sheet. Okay, now another question. How do I call a
range in another workbook?


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default ComboBox and rowsource from an external sheet

On Mar 10, 5:09 am, Andrew wrote:
On Mar 9, 4:35 pm, OssieMac
wrote:



Hi Andrew,


'[Data.xls]Sheet1'!A1:A100


It appears that Data.xls needs to be open to use it as the Rowsource for the
Combo Box.


You can get the syntax for stuff like that by selecting an empty cell in
your workbook and enter = and then select the workbook and then the range and
press Enter. Then just select the formula in the formula bar and copy, press
enter or Esc to get out of the formula bar and paste it into the RowSource.


You might be better to make a range in the workbook with the ComboBox equal
to the range in Data.xls and then use the range in the workbook. That way
Data.xls does not need to be open.


--
Regards,


OssieMac


"Andrew" wrote:
Hello,
I'm trying to fill a combo box from a column of names in another
workbook. Here's what I have:


menu.ComboBox1.RowSource = "'C:\[data.xls]'!A1:A100"


This appears to be correct. I get an error code 380 - could not set
row source property. Can someone tell me what is wrong with this
code?


thanks,
.


Thanks for your help on the sheet name. But if I use a range then I
can simply call the information from another sheet without having to
open the other sheet. Okay, now another question. How do I call a
range in another workbook?


Please allow me to restate: I haven't been able to find any
information on using paths in VBA. If found an online example for a
function called GetValue(), but that function appears to be
unsupported or outdated. Can someone explain how to deal with paths.

set mypath = "C:\datafiles\data012210.xls" - this "would be the path
to the spreadsheet
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ComboBox and rowsource from an external sheet


When you use anther workbook in a formula on the worksheet it doesn't
have to be opened initially, but you do have to open the 2nd workbook to
get the data refreshed.

You don't have to use menu to get a combox but instead you can use a
sheet reference

from
menu.ComboBox1.RowSource = "'C:\[data.xls]'!A1:A100"
to
Activesheet.ComboBox1.RowSource = "'C:\[data.xls]'!A1:A100"

or

Sheets("Sheet2").ComboBox1.RowSource = "'C:\[data.xls]'!A1:A100"


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=186101

Excel Live Chat

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default ComboBox and rowsource from an external sheet

Hi Andres,

Basically the workbook must be open to use it as the Rowsource of the
ComboBox in which case the path is not required. The path in this instance
will cause an error because it is not part of an open workbook name. If you
don't want the workbook to be open then set a range in the workbook with the
combo box equal to the range in the other workbook then use that range with
the combobox.

When setting a range equal to the range in the Data workbook, simply select
the range in the data workbook then select the first cell of where you want
it in the workbook with the combo and paste special link. Close the Data
workbook and excel will look after setting the path, workbook and worksheet
name to the link.

Your use of paths is not incorrect for places where you do require them.


--
Regards,

OssieMac


"Andrew" wrote:

On Mar 10, 5:09 am, Andrew wrote:
On Mar 9, 4:35 pm, OssieMac
wrote:



Hi Andrew,


'[Data.xls]Sheet1'!A1:A100


It appears that Data.xls needs to be open to use it as the Rowsource for the
Combo Box.


You can get the syntax for stuff like that by selecting an empty cell in
your workbook and enter = and then select the workbook and then the range and
press Enter. Then just select the formula in the formula bar and copy, press
enter or Esc to get out of the formula bar and paste it into the RowSource.


You might be better to make a range in the workbook with the ComboBox equal
to the range in Data.xls and then use the range in the workbook. That way
Data.xls does not need to be open.


--
Regards,


OssieMac


"Andrew" wrote:
Hello,
I'm trying to fill a combo box from a column of names in another
workbook. Here's what I have:


menu.ComboBox1.RowSource = "'C:\[data.xls]'!A1:A100"


This appears to be correct. I get an error code 380 - could not set
row source property. Can someone tell me what is wrong with this
code?


thanks,
.


Thanks for your help on the sheet name. But if I use a range then I
can simply call the information from another sheet without having to
open the other sheet. Okay, now another question. How do I call a
range in another workbook?


Please allow me to restate: I haven't been able to find any
information on using paths in VBA. If found an online example for a
function called GetValue(), but that function appears to be
unsupported or outdated. Can someone explain how to deal with paths.

set mypath = "C:\datafiles\data012210.xls" - this "would be the path
to the spreadsheet
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
RowSource as Sheet Names in UserForm ComboBox Orion Cochrane Excel Programming 1 August 24th 09 08:51 PM
RowSource for Sheet ComboBox Minitman Excel Worksheet Functions 3 March 24th 08 09:43 PM
Combobox rowsource Marinos Andreou Excel Programming 2 March 7th 06 05:08 PM
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox Minitman[_4_] Excel Programming 3 October 26th 04 07:58 PM
combobox rowsource Newbie Excel Programming 1 September 8th 04 12:21 PM


All times are GMT +1. The time now is 08:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"