Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My experience with VB in Excel is limited so if some can help me
finish my final project that will be great. I have a userform with a listbox, that I can add and delete records from the listbox during each session while the form is open once I close the form I loose my listbox values. I would like to load this data upon closing the form ie when the form closes that data in the list box will be sent to a page to be reloaded when the form is reopened. Can some one show me the code for this. Thank you Nate My form name is = frmServall My Sheet name is = Sheet3 (where I want to save to and load from) My listbox name is = Listbox1 if you need to see the file email me at and I will send it to you. Thanks Again. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you need to start out with your initial data set in Sheet3, listed from A1
down. in the userform initialize sub: dim myrange as range with sheets("Sheet3") Set myrange = .Range(.Range("A1"), .Range("A1").End(xlDown)) end with For Each c In myrange Listbox1.AddItem c Next c then, before your form closes or unloads: Sheets("Sheet3").Range(Sheets("Sheet3").Range("A1" ), _Sheets("Sheet3").Range("A1").End(xlDown)).Delete For x = 1 To Listbox1.ListCount Sheets("Sheet3").Cells(x,1) = Listbox1.List(x - 1, 0) Next x " wrote: My experience with VB in Excel is limited so if some can help me finish my final project that will be great. I have a userform with a listbox, that I can add and delete records from the listbox during each session while the form is open once I close the form I loose my listbox values. I would like to load this data upon closing the form ie when the form closes that data in the list box will be sent to a page to be reloaded when the form is reopened. Can some one show me the code for this. Thank you Nate My form name is = frmServall My Sheet name is = Sheet3 (where I want to save to and load from) My listbox name is = Listbox1 if you need to see the file email me at and I will send it to you. Thanks Again. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
to write the list - in the terminate event:
for i = 0 to listbox1.Listcount - 1 worksheets("Sheet3").cells(i+1,1) = listbox1.list(i) Next to load the list - in the initialize event: Dim rng as Range with worksheets("Sheet3") set rng = .range(.cells(1,1),.cells(1,1).end(xldown)) End with Listbox1.List = rng.value -- Regards, Tom Ogilvy " wrote: My experience with VB in Excel is limited so if some can help me finish my final project that will be great. I have a userform with a listbox, that I can add and delete records from the listbox during each session while the form is open once I close the form I loose my listbox values. I would like to load this data upon closing the form ie when the form closes that data in the list box will be sent to a page to be reloaded when the form is reopened. Can some one show me the code for this. Thank you Nate My form name is = frmServall My Sheet name is = Sheet3 (where I want to save to and load from) My listbox name is = Listbox1 if you need to see the file email me at and I will send it to you. Thanks Again. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
after adding data, grafics not calculated until save and reload | Charts and Charting in Excel | |||
Reload Listbox - type mismatch error | Excel Programming | |||
Treeview save Data reload, Speichern der Daten Excel VBA | Excel Programming | |||
ListBox with hidden and visible sheet names? | Excel Programming | |||
Saving hidden data with a worksheet (preferably without using a hidden sheet) | Excel Programming |