Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Tdp Tdp is offline
external usenet poster
 
Posts: 74
Default CheckBox does not save value

I have the following code
Private Sub CheckBox1_Click()
If Me.CheckBox1.Value = True Then
Me.TextBox10.Value = Worksheets("Sheet4").Range("E9")
Else
Me.TextBox10.Value = 0
End If
End Sub

The problem I am having is that when I close the UserForm, the values in the
textbox do not save. It seems to default to random number, in this case 74!!??

Can any one hepl?
--
Tdp
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default CheckBox does not save value

So why close the form. Just hide it...

userform1.hide
or
me.hide
--
HTH...

Jim Thomlinson


"Tdp" wrote:

I have the following code
Private Sub CheckBox1_Click()
If Me.CheckBox1.Value = True Then
Me.TextBox10.Value = Worksheets("Sheet4").Range("E9")
Else
Me.TextBox10.Value = 0
End If
End Sub

The problem I am having is that when I close the UserForm, the values in the
textbox do not save. It seems to default to random number, in this case 74!!??

Can any one hepl?
--
Tdp

  #3   Report Post  
Posted to microsoft.public.excel.misc
Tdp Tdp is offline
external usenet poster
 
Posts: 74
Default CheckBox does not save value

Brilliant Jim.
So simple.......did'nt think of that.
Many thanks
--
Tdp


"Jim Thomlinson" wrote:

So why close the form. Just hide it...

userform1.hide
or
me.hide
--
HTH...

Jim Thomlinson


"Tdp" wrote:

I have the following code
Private Sub CheckBox1_Click()
If Me.CheckBox1.Value = True Then
Me.TextBox10.Value = Worksheets("Sheet4").Range("E9")
Else
Me.TextBox10.Value = 0
End If
End Sub

The problem I am having is that when I close the UserForm, the values in the
textbox do not save. It seems to default to random number, in this case 74!!??

Can any one hepl?
--
Tdp

  #4   Report Post  
Posted to microsoft.public.excel.misc
Tdp Tdp is offline
external usenet poster
 
Posts: 74
Default CheckBox does not save value

Spoke too soon.
Iv added a bitton to hide the form, but I close the folder and open it again
it does'nt save the values. Still reverts to the value of 74?
--
Tdp


"Tdp" wrote:

Brilliant Jim.
So simple.......did'nt think of that.
Many thanks
--
Tdp


"Jim Thomlinson" wrote:

So why close the form. Just hide it...

userform1.hide
or
me.hide
--
HTH...

Jim Thomlinson


"Tdp" wrote:

I have the following code
Private Sub CheckBox1_Click()
If Me.CheckBox1.Value = True Then
Me.TextBox10.Value = Worksheets("Sheet4").Range("E9")
Else
Me.TextBox10.Value = 0
End If
End Sub

The problem I am having is that when I close the UserForm, the values in the
textbox do not save. It seems to default to random number, in this case 74!!??

Can any one hepl?
--
Tdp

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,344
Default CheckBox does not save value

Hi,

If you weren't closing the file you could store the value by defining a
global variable, which would survive until you closed the spreadsheet.
However, the easiest way if you are going to close the file is to store the
value in a cell in the spreadsheet:

Sheet1!A1=Me.TextBox10

(don't need the Value argument)

Now to get that value back into the textbox add the following code to the
user form:

Private Sub UserForm_Initialize()
Me.TextBox10 = Sheets("Sheet1").Range("A1")
End Sub

A recommendation - give your user form controls names such as txtDate.

--
Thanks,
Shane Devenshire


"Tdp" wrote:

Spoke too soon.
Iv added a bitton to hide the form, but I close the folder and open it again
it does'nt save the values. Still reverts to the value of 74?
--
Tdp


"Tdp" wrote:

Brilliant Jim.
So simple.......did'nt think of that.
Many thanks
--
Tdp


"Jim Thomlinson" wrote:

So why close the form. Just hide it...

userform1.hide
or
me.hide
--
HTH...

Jim Thomlinson


"Tdp" wrote:

I have the following code
Private Sub CheckBox1_Click()
If Me.CheckBox1.Value = True Then
Me.TextBox10.Value = Worksheets("Sheet4").Range("E9")
Else
Me.TextBox10.Value = 0
End If
End Sub

The problem I am having is that when I close the UserForm, the values in the
textbox do not save. It seems to default to random number, in this case 74!!??

Can any one hepl?
--
Tdp



  #6   Report Post  
Posted to microsoft.public.excel.misc
Tdp Tdp is offline
external usenet poster
 
Posts: 74
Default CheckBox does not save value

Thanks Shane,
I worked out now. Did something the same as you but my codes are alittle
longer but does the job.
I'v used:
Me.TextBox10.Value = Worksheets("Sheet4").Range("E19").Value

Worksheets("Sheet4").Range("E19") = TextBox10.Value
Seems to work ok!
--
Tdp


"ShaneDevenshire" wrote:

Hi,

If you weren't closing the file you could store the value by defining a
global variable, which would survive until you closed the spreadsheet.
However, the easiest way if you are going to close the file is to store the
value in a cell in the spreadsheet:

Sheet1!A1=Me.TextBox10

(don't need the Value argument)

Now to get that value back into the textbox add the following code to the
user form:

Private Sub UserForm_Initialize()
Me.TextBox10 = Sheets("Sheet1").Range("A1")
End Sub

A recommendation - give your user form controls names such as txtDate.

--
Thanks,
Shane Devenshire


"Tdp" wrote:

Spoke too soon.
Iv added a bitton to hide the form, but I close the folder and open it again
it does'nt save the values. Still reverts to the value of 74?
--
Tdp


"Tdp" wrote:

Brilliant Jim.
So simple.......did'nt think of that.
Many thanks
--
Tdp


"Jim Thomlinson" wrote:

So why close the form. Just hide it...

userform1.hide
or
me.hide
--
HTH...

Jim Thomlinson


"Tdp" wrote:

I have the following code
Private Sub CheckBox1_Click()
If Me.CheckBox1.Value = True Then
Me.TextBox10.Value = Worksheets("Sheet4").Range("E9")
Else
Me.TextBox10.Value = 0
End If
End Sub

The problem I am having is that when I close the UserForm, the values in the
textbox do not save. It seems to default to random number, in this case 74!!??

Can any one hepl?
--
Tdp

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
checkbox Jean-Paul Excel Discussion (Misc queries) 0 April 29th 08 02:20 PM
How to have Checkbox A uncheck with checked Checkbox B Texas Aggie Excel Discussion (Misc queries) 3 July 20th 07 10:58 PM
checkBox help!!! riggi Excel Discussion (Misc queries) 1 December 6th 06 09:31 PM
checkbox? rwijnia Excel Worksheet Functions 4 November 3rd 05 07:40 PM
Checkbox!! Oppy Excel Discussion (Misc queries) 2 October 14th 05 05:28 PM


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