ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Refresh listbox on userform1 (https://www.excelbanter.com/excel-programming/292506-refresh-listbox-userform1.html)

Jason Morin[_2_]

Refresh listbox on userform1
 
Hello. The user keys in data to Userform1 and this data
feeds a spreadsheet, row by row (over 5 columns). On this
Userform1 there is a listbox that is populated with the
last 5 entries from the spreadsheet. This is done using a
defined name and a dynamic range formula:

=OFFSET(Sheet2!$A$2,COUNTA(Sheet2!$A:$A)-2,,-5,5)

Issue: I need the listbox to refresh with lastest 5
entries after the user has keyed in a new entry and hit a
command button to put in the data. In Access I have used
Refresh Query on my forms.

Thanks.
Jason

Bob Phillips[_6_]

Refresh listbox on userform1
 
Jason,

Sorry, best I can do is to add this at the end of the code to add the new
entry

Me.ListBox1.RowSource =
"OFFSET(Sheet2!$A$2,COUNTA(Sheet2!$A:$A)-2,,-5,5)"

I did try calling another Listbox event, but they don't seem to force a
refresh.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jason Morin" wrote in message
...
Hello. The user keys in data to Userform1 and this data
feeds a spreadsheet, row by row (over 5 columns). On this
Userform1 there is a listbox that is populated with the
last 5 entries from the spreadsheet. This is done using a
defined name and a dynamic range formula:

=OFFSET(Sheet2!$A$2,COUNTA(Sheet2!$A:$A)-2,,-5,5)

Issue: I need the listbox to refresh with lastest 5
entries after the user has keyed in a new entry and hit a
command button to put in the data. In Access I have used
Refresh Query on my forms.

Thanks.
Jason





All times are GMT +1. The time now is 12:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com