ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting properties of userform controls with VBA (https://www.excelbanter.com/excel-programming/319477-setting-properties-userform-controls-vba.html)

Dave[_52_]

Setting properties of userform controls with VBA
 
Hi

I want to be able to set a controls properties, so that they are
"remembered" for the next time that the spreadsheet is openned.

For example;

I have a userform, with a textbox. I can open up the VB editor, and against
"Value" for the textbox, in the forms properties, I can enter a value. This
value is then saved with the form, and does not rely on the textbox getting
its value from elsewhere, each time the form is openned. Is it possible to
set the value with VBA, as though it was typed in on the editor? I know how
to set it with variables, but I want to essentially store the value with the
forms properties. If i try something like;

MyUserform.MyTextbox.Value = Sheets("Sheet1").Range("A1") whilst it will
show the value in the textbox, it does not save the value with the forms
properties.

The basic reason for me needed this, is I want to have a "Spreadsheet
Settings" form, that does not rely on a worksheet for its values. I want
them all to be held within the form.

Any help much appreciated.

Dave




Bob Phillips[_6_]

Setting properties of userform controls with VBA
 
Dave,

Why do you want to save it with the form, what is wrong with the worksheet?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Dave" wrote in message
...
Hi

I want to be able to set a controls properties, so that they are
"remembered" for the next time that the spreadsheet is openned.

For example;

I have a userform, with a textbox. I can open up the VB editor, and

against
"Value" for the textbox, in the forms properties, I can enter a value.

This
value is then saved with the form, and does not rely on the textbox

getting
its value from elsewhere, each time the form is openned. Is it possible to
set the value with VBA, as though it was typed in on the editor? I know

how
to set it with variables, but I want to essentially store the value with

the
forms properties. If i try something like;

MyUserform.MyTextbox.Value = Sheets("Sheet1").Range("A1") whilst it

will
show the value in the textbox, it does not save the value with the forms
properties.

The basic reason for me needed this, is I want to have a "Spreadsheet
Settings" form, that does not rely on a worksheet for its values. I want
them all to be held within the form.

Any help much appreciated.

Dave







All times are GMT +1. The time now is 01:39 PM.

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