Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default HELP ListBox Save Data to Hidden Sheet, and ReLoad It upon opening

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default HELP ListBox Save Data to Hidden Sheet, and ReLoad It upon opening

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default HELP ListBox Save Data to Hidden Sheet, and ReLoad It upon opening

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
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
after adding data, grafics not calculated until save and reload jbz Charts and Charting in Excel 0 May 3rd 06 10:10 PM
Reload Listbox - type mismatch error Stu[_34_] Excel Programming 3 July 14th 05 01:58 AM
Treeview save Data reload, Speichern der Daten Excel VBA Michael Falter Excel Programming 0 October 16th 04 03:33 PM
ListBox with hidden and visible sheet names? Rockee052[_43_] Excel Programming 8 February 20th 04 09:36 AM
Saving hidden data with a worksheet (preferably without using a hidden sheet) Dick Kusleika[_3_] Excel Programming 2 January 21st 04 04:39 PM


All times are GMT +1. The time now is 11:45 PM.

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"