Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DKS DKS is offline
external usenet poster
 
Posts: 103
Default Refreshing ROWSOURCE

For one of my user-forms, I have a combo-box. The rowsource property
contains a formula using OFFSET function that refers to existing areas in the
existing workbook.

When the form is displayed, the ROWSOURCE works correctly, and the drop-down
is correctly created. Neverthless, if the cells (that are part of the
ROWSOURCE formula) change, the valid values for the combo-box are not
refreshed.

Is there a way to easily refresh the contents programatically?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Refreshing ROWSOURCE

reassign the rowsource.

--
Regards,
Tom Ogilvy


"DKS" wrote in message
...
For one of my user-forms, I have a combo-box. The rowsource property
contains a formula using OFFSET function that refers to existing areas in
the
existing workbook.

When the form is displayed, the ROWSOURCE works correctly, and the
drop-down
is correctly created. Neverthless, if the cells (that are part of the
ROWSOURCE formula) change, the valid values for the combo-box are not
refreshed.

Is there a way to easily refresh the contents programatically?



  #3   Report Post  
Posted to microsoft.public.excel.programming
DKS DKS is offline
external usenet poster
 
Posts: 103
Default Refreshing ROWSOURCE

By reassigning the rowsource do you mean that within the VBA module I
introduce statement to set the value of the combobox? If that is the case
then I had already tried doing it via the VBA module, but given the fact that
I use OFFSET function of .xls and since that is not available as a function
via VBA, I was blocked. That was the reason I asked the question here.

"Tom Ogilvy" wrote:

reassign the rowsource.

--
Regards,
Tom Ogilvy


"DKS" wrote in message
...
For one of my user-forms, I have a combo-box. The rowsource property
contains a formula using OFFSET function that refers to existing areas in
the
existing workbook.

When the form is displayed, the ROWSOURCE works correctly, and the
drop-down
is correctly created. Neverthless, if the cells (that are part of the
ROWSOURCE formula) change, the valid values for the combo-box are not
refreshed.

Is there a way to easily refresh the contents programatically?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Refreshing ROWSOURCE

Given that you can't use the Offset function directly to assign to the
rowsource, the assumption is that you created a defined name with
Insert=name=Define and then assigned that defined name to the rowsource.

rowsource MyList in the property window as an example where the
defined name is list.

then in code

Activesheet.Listbox1.RowSource = "List1:

in code would reset it and pick up your new values.

--
Regards,
Tom Ogilvy

"DKS" wrote in message
...
By reassigning the rowsource do you mean that within the VBA module I
introduce statement to set the value of the combobox? If that is the case
then I had already tried doing it via the VBA module, but given the fact
that
I use OFFSET function of .xls and since that is not available as a
function
via VBA, I was blocked. That was the reason I asked the question here.

"Tom Ogilvy" wrote:

reassign the rowsource.

--
Regards,
Tom Ogilvy


"DKS" wrote in message
...
For one of my user-forms, I have a combo-box. The rowsource property
contains a formula using OFFSET function that refers to existing areas
in
the
existing workbook.

When the form is displayed, the ROWSOURCE works correctly, and the
drop-down
is correctly created. Neverthless, if the cells (that are part of the
ROWSOURCE formula) change, the valid values for the combo-box are not
refreshed.

Is there a way to easily refresh the contents programatically?






  #5   Report Post  
Posted to microsoft.public.excel.programming
DKS DKS is offline
external usenet poster
 
Posts: 103
Default Refreshing ROWSOURCE

In the property window for the combobox, .xls allows me to use OFFSET
function. That is how I got the correct values.

But within a VBA code I cannot use OFFSET function (or at least I did not
find a way to use it).

My OFFSET function refers to one other cell that is updated by the form.
Thus, what happens is that the form updates a cell. And when that cell is
updated, I expect the OFFSET function to deliver different results and thus
different "values" behind my combo-box. However, the ROWSOURCE value is
assigned when the form is displayed, and it never gets re-evaluated (or
refreshed).




"Tom Ogilvy" wrote:

Given that you can't use the Offset function directly to assign to the
rowsource, the assumption is that you created a defined name with
Insert=name=Define and then assigned that defined name to the rowsource.

rowsource MyList in the property window as an example where the
defined name is list.

then in code

Activesheet.Listbox1.RowSource = "List1:

in code would reset it and pick up your new values.

--
Regards,
Tom Ogilvy

"DKS" wrote in message
...
By reassigning the rowsource do you mean that within the VBA module I
introduce statement to set the value of the combobox? If that is the case
then I had already tried doing it via the VBA module, but given the fact
that
I use OFFSET function of .xls and since that is not available as a
function
via VBA, I was blocked. That was the reason I asked the question here.

"Tom Ogilvy" wrote:

reassign the rowsource.

--
Regards,
Tom Ogilvy


"DKS" wrote in message
...
For one of my user-forms, I have a combo-box. The rowsource property
contains a formula using OFFSET function that refers to existing areas
in
the
existing workbook.

When the form is displayed, the ROWSOURCE works correctly, and the
drop-down
is correctly created. Neverthless, if the cells (that are part of the
ROWSOURCE formula) change, the valid values for the combo-box are not
refreshed.

Is there a way to easily refresh the contents programatically?








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Refreshing ROWSOURCE

Well, that is a new one on me.

anyway, are you using a formula like this:

offset(Sheet1!$A$1,0,0,countA(sheet1!$A:$A),1)

--
Regards,
Tom Ogilvy

"DKS" wrote in message
...
In the property window for the combobox, .xls allows me to use OFFSET
function. That is how I got the correct values.

But within a VBA code I cannot use OFFSET function (or at least I did not
find a way to use it).

My OFFSET function refers to one other cell that is updated by the form.
Thus, what happens is that the form updates a cell. And when that cell is
updated, I expect the OFFSET function to deliver different results and
thus
different "values" behind my combo-box. However, the ROWSOURCE value is
assigned when the form is displayed, and it never gets re-evaluated (or
refreshed).




"Tom Ogilvy" wrote:

Given that you can't use the Offset function directly to assign to the
rowsource, the assumption is that you created a defined name with
Insert=name=Define and then assigned that defined name to the
rowsource.

rowsource MyList in the property window as an example where
the
defined name is list.

then in code

Activesheet.Listbox1.RowSource = "List1:

in code would reset it and pick up your new values.

--
Regards,
Tom Ogilvy

"DKS" wrote in message
...
By reassigning the rowsource do you mean that within the VBA module I
introduce statement to set the value of the combobox? If that is the
case
then I had already tried doing it via the VBA module, but given the
fact
that
I use OFFSET function of .xls and since that is not available as a
function
via VBA, I was blocked. That was the reason I asked the question here.

"Tom Ogilvy" wrote:

reassign the rowsource.

--
Regards,
Tom Ogilvy


"DKS" wrote in message
...
For one of my user-forms, I have a combo-box. The rowsource
property
contains a formula using OFFSET function that refers to existing
areas
in
the
existing workbook.

When the form is displayed, the ROWSOURCE works correctly, and the
drop-down
is correctly created. Neverthless, if the cells (that are part of
the
ROWSOURCE formula) change, the valid values for the combo-box are
not
refreshed.

Is there a way to easily refresh the contents programatically?








  #7   Report Post  
Posted to microsoft.public.excel.programming
DKS DKS is offline
external usenet poster
 
Posts: 103
Default Refreshing ROWSOURCE

Your understanding of the situation is almost correct. With the added
complexity that the cell Sheet1!$A$1 (as referred to by in your formula) is
in the CONTROLSOURCE property of another field on the form, let us say
REGION.

Thus my idea was that depending on what the user fills on the form REGION on
screen, it is reflected in the spreadsheet SHEET1. And based on this change
in the spreadsheet, I expected the ROWSOURCE property to get changed
dynamically. Which of course is not happening because ROWSOURCE is set when
the form is loaded.

For info: the exact formula that I am using for ROWSOURCE property is as
follows:
PLEASE NOTE that in my formula I am referring to $F$1 and not $A$1 for the
variable part of the rowsource.

OFFSET(Sheet1!$A$1,MATCH(Sheet1!$F$1,Sheet1!$A:$A, 0)-1,3,COUNTIF(Sheet1!$A:$A,Sheet1!$F$1),1)

where cell F1 is in the CONTROLSOURCE property of Region.

Hope all the above starts to make sense to you.


"Tom Ogilvy" wrote:

Well, that is a new one on me.

anyway, are you using a formula like this:

offset(Sheet1!$A$1,0,0,countA(sheet1!$A:$A),1)

--
Regards,
Tom Ogilvy

"DKS" wrote in message
...
In the property window for the combobox, .xls allows me to use OFFSET
function. That is how I got the correct values.

But within a VBA code I cannot use OFFSET function (or at least I did not
find a way to use it).

My OFFSET function refers to one other cell that is updated by the form.
Thus, what happens is that the form updates a cell. And when that cell is
updated, I expect the OFFSET function to deliver different results and
thus
different "values" behind my combo-box. However, the ROWSOURCE value is
assigned when the form is displayed, and it never gets re-evaluated (or
refreshed).




"Tom Ogilvy" wrote:

Given that you can't use the Offset function directly to assign to the
rowsource, the assumption is that you created a defined name with
Insert=name=Define and then assigned that defined name to the
rowsource.

rowsource MyList in the property window as an example where
the
defined name is list.

then in code

Activesheet.Listbox1.RowSource = "List1:

in code would reset it and pick up your new values.

--
Regards,
Tom Ogilvy

"DKS" wrote in message
...
By reassigning the rowsource do you mean that within the VBA module I
introduce statement to set the value of the combobox? If that is the
case
then I had already tried doing it via the VBA module, but given the
fact
that
I use OFFSET function of .xls and since that is not available as a
function
via VBA, I was blocked. That was the reason I asked the question here.

"Tom Ogilvy" wrote:

reassign the rowsource.

--
Regards,
Tom Ogilvy


"DKS" wrote in message
...
For one of my user-forms, I have a combo-box. The rowsource
property
contains a formula using OFFSET function that refers to existing
areas
in
the
existing workbook.

When the form is displayed, the ROWSOURCE works correctly, and the
drop-down
is correctly created. Neverthless, if the cells (that are part of
the
ROWSOURCE formula) change, the valid values for the combo-box are
not
refreshed.

Is there a way to easily refresh the contents programatically?









  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Refreshing ROWSOURCE

I think you are going to just have to reassign the rowsource to get it to
update.

--
Regards,
Tom Ogilvy


"DKS" wrote in message
...
Your understanding of the situation is almost correct. With the added
complexity that the cell Sheet1!$A$1 (as referred to by in your formula)
is
in the CONTROLSOURCE property of another field on the form, let us say
REGION.

Thus my idea was that depending on what the user fills on the form REGION
on
screen, it is reflected in the spreadsheet SHEET1. And based on this
change
in the spreadsheet, I expected the ROWSOURCE property to get changed
dynamically. Which of course is not happening because ROWSOURCE is set
when
the form is loaded.

For info: the exact formula that I am using for ROWSOURCE property is as
follows:
PLEASE NOTE that in my formula I am referring to $F$1 and not $A$1 for the
variable part of the rowsource.

OFFSET(Sheet1!$A$1,MATCH(Sheet1!$F$1,Sheet1!$A:$A, 0)-1,3,COUNTIF(Sheet1!$A:$A,Sheet1!$F$1),1)

where cell F1 is in the CONTROLSOURCE property of Region.

Hope all the above starts to make sense to you.


"Tom Ogilvy" wrote:

Well, that is a new one on me.

anyway, are you using a formula like this:

offset(Sheet1!$A$1,0,0,countA(sheet1!$A:$A),1)

--
Regards,
Tom Ogilvy

"DKS" wrote in message
...
In the property window for the combobox, .xls allows me to use OFFSET
function. That is how I got the correct values.

But within a VBA code I cannot use OFFSET function (or at least I did
not
find a way to use it).

My OFFSET function refers to one other cell that is updated by the
form.
Thus, what happens is that the form updates a cell. And when that cell
is
updated, I expect the OFFSET function to deliver different results and
thus
different "values" behind my combo-box. However, the ROWSOURCE value
is
assigned when the form is displayed, and it never gets re-evaluated (or
refreshed).




"Tom Ogilvy" wrote:

Given that you can't use the Offset function directly to assign to the
rowsource, the assumption is that you created a defined name with
Insert=name=Define and then assigned that defined name to the
rowsource.

rowsource MyList in the property window as an example
where
the
defined name is list.

then in code

Activesheet.Listbox1.RowSource = "List1:

in code would reset it and pick up your new values.

--
Regards,
Tom Ogilvy

"DKS" wrote in message
...
By reassigning the rowsource do you mean that within the VBA module
I
introduce statement to set the value of the combobox? If that is
the
case
then I had already tried doing it via the VBA module, but given the
fact
that
I use OFFSET function of .xls and since that is not available as a
function
via VBA, I was blocked. That was the reason I asked the question
here.

"Tom Ogilvy" wrote:

reassign the rowsource.

--
Regards,
Tom Ogilvy


"DKS" wrote in message
...
For one of my user-forms, I have a combo-box. The rowsource
property
contains a formula using OFFSET function that refers to existing
areas
in
the
existing workbook.

When the form is displayed, the ROWSOURCE works correctly, and
the
drop-down
is correctly created. Neverthless, if the cells (that are part
of
the
ROWSOURCE formula) change, the valid values for the combo-box are
not
refreshed.

Is there a way to easily refresh the contents programatically?











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 Patrick Simonds Excel Programming 1 August 5th 06 01:25 AM
help with rowsource GMet Excel Programming 4 September 24th 04 02:30 PM
combobox rowsource Newbie Excel Programming 1 September 8th 04 12:21 PM
Using IF, Then with rowsource? CAA[_23_] Excel Programming 8 April 4th 04 08:56 PM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM


All times are GMT +1. The time now is 06:21 PM.

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

About Us

"It's about Microsoft Excel"