Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Storing TextBox info in cells, then retrieving on next load-up


I would like to store whatever is in a form, into the cells on a
spreadsheat. Then have the spreadsheet restore the information on the
next loadup. the code I have is as follows:

Code:
--------------------
Sub Auto_Open()

CRF_Form.TextBox1.SetFocus

Worksheets("Sheet1").Activate

ActiveWorkbook.Saved = False

Range("J1").Value = CRF_Form.TextBox1.Text
Range("J2").Value = CRF_Form.TextBox2.Text
Range("J3").Value = CRF_Form.TextBox3.Text
Range("J4").Value = CRF_Form.TextBox4.Text
Range("J5").Value = CRF_Form.TextBox5.Text
Range("J6").Value = CRF_Form.TextBox6.Text
Range("J7").Value = CRF_Form.TextBox7.Text
Range("J8").Value = CRF_Form.TextBox8.Text
Range("J9").Value = CRF_Form.TextBox9.Text
Range("J10").Value = CRF_Form.TextBox10.Text
Range("J11").Value = CRF_Form.TextBox11.Text
Range("J12").Value = CRF_Form.TextBox12.Text
Range("J13").Value = CRF_Form.TextBox13.Text
Range("J14").Value = CRF_Form.TextBox14.Text
Range("J15").Value = CRF_Form.TextBox15.Text
Range("J16").Value = CRF_Form.TextBox16.Text
Range("J17").Value = CRF_Form.TextBox17.Text
Range("J18").Value = CRF_Form.TextBox18.Text
Range("J19").Value = CRF_Form.TextBox19.Text
Range("J20").Value = CRF_Form.TextBox20.Text
Range("J21").Value = CRF_Form.TextBox21.Text
Range("J22").Value = CRF_Form.TextBox22.Text
Range("J23").Value = CRF_Form.TextBox23.Text
Range("J24").Value = CRF_Form.TextBox24.Text
Range("J25").Value = CRF_Form.TextBox25.Text

CRF_Form.Show
Unload CRF_Form

End Sub
--------------------



Code:
--------------------
Private Sub Save_Button_Click()

Application.DefaultSaveFormat = xlExcel2003Workbook
' Set NewBook = Workbooks.Add

Worksheets("Sheet1").Activate
CRF_Form.TextBox1.Text = Range("J1").Value
CRF_Form.TextBox2.Text = Range("J2").Value
CRF_Form.TextBox3.Text = Range("J3").Value
CRF_Form.TextBox4.Text = Range("J4").Value
CRF_Form.TextBox5.Text = Range("J5").Value
CRF_Form.TextBox6.Text = Range("J6").Value
CRF_Form.TextBox7.Text = Range("J7").Value
CRF_Form.TextBox8.Text = Range("J8").Value
CRF_Form.TextBox9.Text = Range("J9").Value
CRF_Form.TextBox10.Text = Range("J10").Value
CRF_Form.TextBox11.Text = Range("J11").Value
CRF_Form.TextBox12.Text = Range("J12").Value
CRF_Form.TextBox13.Text = Range("J13").Value
CRF_Form.TextBox14.Text = Range("J14").Value
CRF_Form.TextBox15.Text = Range("J15").Value
CRF_Form.TextBox16.Text = Range("J16").Value
CRF_Form.TextBox17.Text = Range("J17").Value
CRF_Form.TextBox18.Text = Range("J18").Value
CRF_Form.TextBox19.Text = Range("J19").Value
CRF_Form.TextBox20.Text = Range("J20").Value
CRF_Form.TextBox21.Text = Range("J21").Value
CRF_Form.TextBox22.Text = Range("J22").Value
CRF_Form.TextBox23.Text = Range("J23").Value
CRF_Form.TextBox24.Text = Range("J24").Value
CRF_Form.TextBox25.Text = Range("J25").Value

Do
fName = Application.GetSaveAsFilename
Loop Until fName < False
ActiveWorkbook.SaveAs Filename:=fName
ActiveWorkbook.Saved = True

End Sub
--------------------


Can someone tell me what I'm doing wrong (it just doesn't save the data
into the cells)?

Thank you so much for any input (me being a newbie doesn't help, I
really need a piece of knowledge here).


--
jlroper
------------------------------------------------------------------------
jlroper's Profile: http://www.excelforum.com/member.php...o&userid=26709
View this thread: http://www.excelforum.com/showthread...hreadid=400687

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Storing TextBox info in cells, then retrieving on next load-up

It looks like you have your assignments backwards.

the AutoOpen writes the control values to the cells.

the button click creates a new workbook. assign the controls on the forms
the value of the cells (which are blank) and saves the workbook.

--
Regards,
Tom Ogilvy


"jlroper" wrote in
message ...

I would like to store whatever is in a form, into the cells on a
spreadsheat. Then have the spreadsheet restore the information on the
next loadup. the code I have is as follows:

Code:
--------------------
Sub Auto_Open()

CRF_Form.TextBox1.SetFocus

Worksheets("Sheet1").Activate

ActiveWorkbook.Saved = False

Range("J1").Value = CRF_Form.TextBox1.Text
Range("J2").Value = CRF_Form.TextBox2.Text
Range("J3").Value = CRF_Form.TextBox3.Text
Range("J4").Value = CRF_Form.TextBox4.Text
Range("J5").Value = CRF_Form.TextBox5.Text
Range("J6").Value = CRF_Form.TextBox6.Text
Range("J7").Value = CRF_Form.TextBox7.Text
Range("J8").Value = CRF_Form.TextBox8.Text
Range("J9").Value = CRF_Form.TextBox9.Text
Range("J10").Value = CRF_Form.TextBox10.Text
Range("J11").Value = CRF_Form.TextBox11.Text
Range("J12").Value = CRF_Form.TextBox12.Text
Range("J13").Value = CRF_Form.TextBox13.Text
Range("J14").Value = CRF_Form.TextBox14.Text
Range("J15").Value = CRF_Form.TextBox15.Text
Range("J16").Value = CRF_Form.TextBox16.Text
Range("J17").Value = CRF_Form.TextBox17.Text
Range("J18").Value = CRF_Form.TextBox18.Text
Range("J19").Value = CRF_Form.TextBox19.Text
Range("J20").Value = CRF_Form.TextBox20.Text
Range("J21").Value = CRF_Form.TextBox21.Text
Range("J22").Value = CRF_Form.TextBox22.Text
Range("J23").Value = CRF_Form.TextBox23.Text
Range("J24").Value = CRF_Form.TextBox24.Text
Range("J25").Value = CRF_Form.TextBox25.Text

CRF_Form.Show
Unload CRF_Form

End Sub
--------------------



Code:
--------------------
Private Sub Save_Button_Click()

Application.DefaultSaveFormat = xlExcel2003Workbook
' Set NewBook = Workbooks.Add

Worksheets("Sheet1").Activate
CRF_Form.TextBox1.Text = Range("J1").Value
CRF_Form.TextBox2.Text = Range("J2").Value
CRF_Form.TextBox3.Text = Range("J3").Value
CRF_Form.TextBox4.Text = Range("J4").Value
CRF_Form.TextBox5.Text = Range("J5").Value
CRF_Form.TextBox6.Text = Range("J6").Value
CRF_Form.TextBox7.Text = Range("J7").Value
CRF_Form.TextBox8.Text = Range("J8").Value
CRF_Form.TextBox9.Text = Range("J9").Value
CRF_Form.TextBox10.Text = Range("J10").Value
CRF_Form.TextBox11.Text = Range("J11").Value
CRF_Form.TextBox12.Text = Range("J12").Value
CRF_Form.TextBox13.Text = Range("J13").Value
CRF_Form.TextBox14.Text = Range("J14").Value
CRF_Form.TextBox15.Text = Range("J15").Value
CRF_Form.TextBox16.Text = Range("J16").Value
CRF_Form.TextBox17.Text = Range("J17").Value
CRF_Form.TextBox18.Text = Range("J18").Value
CRF_Form.TextBox19.Text = Range("J19").Value
CRF_Form.TextBox20.Text = Range("J20").Value
CRF_Form.TextBox21.Text = Range("J21").Value
CRF_Form.TextBox22.Text = Range("J22").Value
CRF_Form.TextBox23.Text = Range("J23").Value
CRF_Form.TextBox24.Text = Range("J24").Value
CRF_Form.TextBox25.Text = Range("J25").Value

Do
fName = Application.GetSaveAsFilename
Loop Until fName < False
ActiveWorkbook.SaveAs Filename:=fName
ActiveWorkbook.Saved = True

End Sub
--------------------


Can someone tell me what I'm doing wrong (it just doesn't save the data
into the cells)?

Thank you so much for any input (me being a newbie doesn't help, I
really need a piece of knowledge here).


--
jlroper
------------------------------------------------------------------------
jlroper's Profile:

http://www.excelforum.com/member.php...o&userid=26709
View this thread: http://www.excelforum.com/showthread...hreadid=400687



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Storing TextBox info in cells, then retrieving on next load-up


It works fine now, thanks

--
jlrope
-----------------------------------------------------------------------
jlroper's Profile: http://www.excelforum.com/member.php...fo&userid=2670
View this thread: http://www.excelforum.com/showthread.php?threadid=40068

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
Retrieving info from multiple tables PMaravy Excel Discussion (Misc queries) 1 October 10th 08 05:15 PM
Storing TextBox info in cells, then retrieving on next load-up T-®ex[_48_] Excel Programming 0 August 31st 05 07:51 AM
Finding and retrieving info Matthew McManus[_2_] Excel Programming 2 February 18th 04 03:33 AM
Storing and Retrieving Variables Question JasonSelf Excel Programming 2 January 23rd 04 03:12 PM


All times are GMT +1. The time now is 02:37 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"