ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   whats it do (https://www.excelbanter.com/excel-discussion-misc-queries/138524-whats-do.html)

Curt

whats it do
 
Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks

leung

whats it do
 
This cannot be simply explained.

Actually compilation make your code run faster in terms of processing.
However if you excel work involves stupid / inefficient design, compile
cannot help much. About portability (before making it add-in, xla file), if
you compile it, for other people to use it, they need Excel application as
well (i mean it cannot be run standalone like exe). It probably a good way
for you to check if you are doing all the variables right...

i think it is a necessary step for creating add-ins



"Curt" wrote:

Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks


Jim Cone

whats it do
 

Curt,
The short explanation is that compiling your VBA code translates it into
code that your computer can read and execute. This is done automatically
if you don't do it.
Also, if it won't compile it will not run and you had better fix it.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Curt"
wrote in message
Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks

Curt

whats it do
 
Thank You for info will expermint Dont know if I have done it all right but
I've tried
Thanks Again

"Leung" wrote:

This cannot be simply explained.

Actually compilation make your code run faster in terms of processing.
However if you excel work involves stupid / inefficient design, compile
cannot help much. About portability (before making it add-in, xla file), if
you compile it, for other people to use it, they need Excel application as
well (i mean it cannot be run standalone like exe). It probably a good way
for you to check if you are doing all the variables right...

i think it is a necessary step for creating add-ins



"Curt" wrote:

Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks


Curt

whats it do
 
It does it on its own? Suprise to me. So if I follow if I run compile and it
doesn't work. Then some of my code is out of place.
Thanks

"Jim Cone" wrote:


Curt,
The short explanation is that compiling your VBA code translates it into
code that your computer can read and execute. This is done automatically
if you don't do it.
Also, if it won't compile it will not run and you had better fix it.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Curt"
wrote in message
Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks


Dave Peterson

whats it do
 
I use it to debug my code. If there's a syntax error (or undeclared variable),
then I'll get errors in the compile.

You can read some notes by Don Baarns at about what compiling means to VBA:
http://archive.baarns.com/excel/develop/vbaperfm.asp

And if you're interested in cleaning your code, try Rob Bovey's code cleaner:
You can find it he
http://www.appspro.com/
or directly
http://www.appspro.com/Utilities/CodeCleaner.htm


Curt wrote:

Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks


--

Dave Peterson

Curt

whats it do
 
Thanks to all for smarting me up. Now I get it. Tried on one procedure and
found var not declared. Would someone advise as to what I should call a
option button. Also due to my learning curve. I have buttons numbered from
1-27. Is it possible to renumber these buttons as total i have maybe 10.
Thanks Again

"Dave Peterson" wrote:

I use it to debug my code. If there's a syntax error (or undeclared variable),
then I'll get errors in the compile.

You can read some notes by Don Baarns at about what compiling means to VBA:
http://archive.baarns.com/excel/develop/vbaperfm.asp

And if you're interested in cleaning your code, try Rob Bovey's code cleaner:
You can find it he
http://www.appspro.com/
or directly
http://www.appspro.com/Utilities/CodeCleaner.htm


Curt wrote:

Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks


--

Dave Peterson


Dave Peterson

whats it do
 
Are these on a worksheet or on a userform?

If they're on a worksheet, are they optionbuttons from the control toolbox
toolbar or from the Forms toolbar?

If you wanted a macro to do the renaming, the code would be different.

But since there's only 10 optionbuttons, you can do them manually.

You can select the optionbutton and then just type the new name in the namebox
(to the left of the formulabar).

If the optionbuttons are from the Control Toolbox toolbar, then you'll have to
be in design mode first.

As for naming them, you can choose any name that's valid. But if you're going
to refer to them later on, using something mnemonically significant would be
best.

But if you're using a linked cell to get the status, maybe it's not too
important -- I do like naming shapes based on their position in the worksheet:

OptBtn_A1

(if it's always in A1)

Curt wrote:

Thanks to all for smarting me up. Now I get it. Tried on one procedure and
found var not declared. Would someone advise as to what I should call a
option button. Also due to my learning curve. I have buttons numbered from
1-27. Is it possible to renumber these buttons as total i have maybe 10.
Thanks Again

"Dave Peterson" wrote:

I use it to debug my code. If there's a syntax error (or undeclared variable),
then I'll get errors in the compile.

You can read some notes by Don Baarns at about what compiling means to VBA:
http://archive.baarns.com/excel/develop/vbaperfm.asp

And if you're interested in cleaning your code, try Rob Bovey's code cleaner:
You can find it he
http://www.appspro.com/
or directly
http://www.appspro.com/Utilities/CodeCleaner.htm


Curt wrote:

Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks


--

Dave Peterson


--

Dave Peterson

Curt

whats it do
 
These are on user form In the properties page at top it says name is this
what you mean by formula bar. When I view code and click on th option button
am asked to view code or properties. This is where I am ok. From forms
toolbar not active X controls. Useiong option explicd asked to declare
optionbutton1 not defined. Would all need to be defined. also defined as
what. All buttons have one thing to do. Ain't smart enought to do more than
one thing at a time.
Do know this many of those who volunteer for the Vet's Day parade are
looking forward for this program.
I can not express enough my gratuide to those of you who answer this forum.
Will expermint with names and see what happens.
Thank You

"Dave Peterson" wrote:

Are these on a worksheet or on a userform?

If they're on a worksheet, are they optionbuttons from the control toolbox
toolbar or from the Forms toolbar?

If you wanted a macro to do the renaming, the code would be different.

But since there's only 10 optionbuttons, you can do them manually.

You can select the optionbutton and then just type the new name in the namebox
(to the left of the formulabar).

If the optionbuttons are from the Control Toolbox toolbar, then you'll have to
be in design mode first.

As for naming them, you can choose any name that's valid. But if you're going
to refer to them later on, using something mnemonically significant would be
best.

But if you're using a linked cell to get the status, maybe it's not too
important -- I do like naming shapes based on their position in the worksheet:

OptBtn_A1

(if it's always in A1)

Curt wrote:

Thanks to all for smarting me up. Now I get it. Tried on one procedure and
found var not declared. Would someone advise as to what I should call a
option button. Also due to my learning curve. I have buttons numbered from
1-27. Is it possible to renumber these buttons as total i have maybe 10.
Thanks Again

"Dave Peterson" wrote:

I use it to debug my code. If there's a syntax error (or undeclared variable),
then I'll get errors in the compile.

You can read some notes by Don Baarns at about what compiling means to VBA:
http://archive.baarns.com/excel/develop/vbaperfm.asp

And if you're interested in cleaning your code, try Rob Bovey's code cleaner:
You can find it he
http://www.appspro.com/
or directly
http://www.appspro.com/Utilities/CodeCleaner.htm


Curt wrote:

Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks

--

Dave Peterson


--

Dave Peterson


Dave Peterson

whats it do
 
There's a difference between creating a "form" on a worksheet and a userform
found inside the VBE--the userform inside the VBE would look a lot like the
dialog that you see when you use Tools|Options.

If they are optionbuttons from the Forms toolbar that are placed on the
worksheet, then you won't see "view code".

I think you'll have to clarify again.



Curt wrote:

These are on user form In the properties page at top it says name is this
what you mean by formula bar. When I view code and click on th option button
am asked to view code or properties. This is where I am ok. From forms
toolbar not active X controls. Useiong option explicd asked to declare
optionbutton1 not defined. Would all need to be defined. also defined as
what. All buttons have one thing to do. Ain't smart enought to do more than
one thing at a time.
Do know this many of those who volunteer for the Vet's Day parade are
looking forward for this program.
I can not express enough my gratuide to those of you who answer this forum.
Will expermint with names and see what happens.
Thank You

"Dave Peterson" wrote:

Are these on a worksheet or on a userform?

If they're on a worksheet, are they optionbuttons from the control toolbox
toolbar or from the Forms toolbar?

If you wanted a macro to do the renaming, the code would be different.

But since there's only 10 optionbuttons, you can do them manually.

You can select the optionbutton and then just type the new name in the namebox
(to the left of the formulabar).

If the optionbuttons are from the Control Toolbox toolbar, then you'll have to
be in design mode first.

As for naming them, you can choose any name that's valid. But if you're going
to refer to them later on, using something mnemonically significant would be
best.

But if you're using a linked cell to get the status, maybe it's not too
important -- I do like naming shapes based on their position in the worksheet:

OptBtn_A1

(if it's always in A1)

Curt wrote:

Thanks to all for smarting me up. Now I get it. Tried on one procedure and
found var not declared. Would someone advise as to what I should call a
option button. Also due to my learning curve. I have buttons numbered from
1-27. Is it possible to renumber these buttons as total i have maybe 10.
Thanks Again

"Dave Peterson" wrote:

I use it to debug my code. If there's a syntax error (or undeclared variable),
then I'll get errors in the compile.

You can read some notes by Don Baarns at about what compiling means to VBA:
http://archive.baarns.com/excel/develop/vbaperfm.asp

And if you're interested in cleaning your code, try Rob Bovey's code cleaner:
You can find it he
http://www.appspro.com/
or directly
http://www.appspro.com/Utilities/CodeCleaner.htm


Curt wrote:

Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson

Curt

whats it do
 
Dave I will try to clarify better
I get view code from excel
VBA project
open Userform 1
click on toolbox
pull option button from toolbox
go to properties change nbr then to userforn and do same.
I think I did all right havent had time to check yet
Got ambigous name one time tho.
Must of missed changeing something
Thanks Again
Curt


"Dave Peterson" wrote:

There's a difference between creating a "form" on a worksheet and a userform
found inside the VBE--the userform inside the VBE would look a lot like the
dialog that you see when you use Tools|Options.

If they are optionbuttons from the Forms toolbar that are placed on the
worksheet, then you won't see "view code".

I think you'll have to clarify again.



Curt wrote:

These are on user form In the properties page at top it says name is this
what you mean by formula bar. When I view code and click on th option button
am asked to view code or properties. This is where I am ok. From forms
toolbar not active X controls. Useiong option explicd asked to declare
optionbutton1 not defined. Would all need to be defined. also defined as
what. All buttons have one thing to do. Ain't smart enought to do more than
one thing at a time.
Do know this many of those who volunteer for the Vet's Day parade are
looking forward for this program.
I can not express enough my gratuide to those of you who answer this forum.
Will expermint with names and see what happens.
Thank You

"Dave Peterson" wrote:

Are these on a worksheet or on a userform?

If they're on a worksheet, are they optionbuttons from the control toolbox
toolbar or from the Forms toolbar?

If you wanted a macro to do the renaming, the code would be different.

But since there's only 10 optionbuttons, you can do them manually.

You can select the optionbutton and then just type the new name in the namebox
(to the left of the formulabar).

If the optionbuttons are from the Control Toolbox toolbar, then you'll have to
be in design mode first.

As for naming them, you can choose any name that's valid. But if you're going
to refer to them later on, using something mnemonically significant would be
best.

But if you're using a linked cell to get the status, maybe it's not too
important -- I do like naming shapes based on their position in the worksheet:

OptBtn_A1

(if it's always in A1)

Curt wrote:

Thanks to all for smarting me up. Now I get it. Tried on one procedure and
found var not declared. Would someone advise as to what I should call a
option button. Also due to my learning curve. I have buttons numbered from
1-27. Is it possible to renumber these buttons as total i have maybe 10.
Thanks Again

"Dave Peterson" wrote:

I use it to debug my code. If there's a syntax error (or undeclared variable),
then I'll get errors in the compile.

You can read some notes by Don Baarns at about what compiling means to VBA:
http://archive.baarns.com/excel/develop/vbaperfm.asp

And if you're interested in cleaning your code, try Rob Bovey's code cleaner:
You can find it he
http://www.appspro.com/
or directly
http://www.appspro.com/Utilities/CodeCleaner.htm


Curt wrote:

Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


Dave Peterson

whats it do
 
I understand!

Each control on that userform has to have a unique name--no duplicates.

Select any of the optionbuttons you want to change
Hit F4 to see the properties window
Look for a property called (Name) -- it includes the ()'s.
(It should be right near the top in either the Alphabetic or catorized tab)
Type the new name to the right of that property.

And to keep optionbuttons from being grouped with other optionbuttons, you can
either put each group in a frame--or give each group the same groupname.

======
Say you change the name of an optionbutton to OptKeepHistory, then you could
refer to it in (say) the Ok button's procedu

Option Explicit
Private Sub Ok_Click()
If Me.OptKeepHistory = True Then
MsgBox "You chose to keep history"
End If
End Sub


Curt wrote:

Dave I will try to clarify better
I get view code from excel
VBA project
open Userform 1
click on toolbox
pull option button from toolbox
go to properties change nbr then to userforn and do same.
I think I did all right havent had time to check yet
Got ambigous name one time tho.
Must of missed changeing something
Thanks Again
Curt

"Dave Peterson" wrote:

There's a difference between creating a "form" on a worksheet and a userform
found inside the VBE--the userform inside the VBE would look a lot like the
dialog that you see when you use Tools|Options.

If they are optionbuttons from the Forms toolbar that are placed on the
worksheet, then you won't see "view code".

I think you'll have to clarify again.



Curt wrote:

These are on user form In the properties page at top it says name is this
what you mean by formula bar. When I view code and click on th option button
am asked to view code or properties. This is where I am ok. From forms
toolbar not active X controls. Useiong option explicd asked to declare
optionbutton1 not defined. Would all need to be defined. also defined as
what. All buttons have one thing to do. Ain't smart enought to do more than
one thing at a time.
Do know this many of those who volunteer for the Vet's Day parade are
looking forward for this program.
I can not express enough my gratuide to those of you who answer this forum.
Will expermint with names and see what happens.
Thank You

"Dave Peterson" wrote:

Are these on a worksheet or on a userform?

If they're on a worksheet, are they optionbuttons from the control toolbox
toolbar or from the Forms toolbar?

If you wanted a macro to do the renaming, the code would be different.

But since there's only 10 optionbuttons, you can do them manually.

You can select the optionbutton and then just type the new name in the namebox
(to the left of the formulabar).

If the optionbuttons are from the Control Toolbox toolbar, then you'll have to
be in design mode first.

As for naming them, you can choose any name that's valid. But if you're going
to refer to them later on, using something mnemonically significant would be
best.

But if you're using a linked cell to get the status, maybe it's not too
important -- I do like naming shapes based on their position in the worksheet:

OptBtn_A1

(if it's always in A1)

Curt wrote:

Thanks to all for smarting me up. Now I get it. Tried on one procedure and
found var not declared. Would someone advise as to what I should call a
option button. Also due to my learning curve. I have buttons numbered from
1-27. Is it possible to renumber these buttons as total i have maybe 10.
Thanks Again

"Dave Peterson" wrote:

I use it to debug my code. If there's a syntax error (or undeclared variable),
then I'll get errors in the compile.

You can read some notes by Don Baarns at about what compiling means to VBA:
http://archive.baarns.com/excel/develop/vbaperfm.asp

And if you're interested in cleaning your code, try Rob Bovey's code cleaner:
You can find it he
http://www.appspro.com/
or directly
http://www.appspro.com/Utilities/CodeCleaner.htm


Curt wrote:

Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson

Curt

whats it do
 
Thanks Much Dave will proceed with more confidence.
Thanks Again
Will probably be back agaon
Curt

"Dave Peterson" wrote:

I understand!

Each control on that userform has to have a unique name--no duplicates.

Select any of the optionbuttons you want to change
Hit F4 to see the properties window
Look for a property called (Name) -- it includes the ()'s.
(It should be right near the top in either the Alphabetic or catorized tab)
Type the new name to the right of that property.

And to keep optionbuttons from being grouped with other optionbuttons, you can
either put each group in a frame--or give each group the same groupname.

======
Say you change the name of an optionbutton to OptKeepHistory, then you could
refer to it in (say) the Ok button's procedu

Option Explicit
Private Sub Ok_Click()
If Me.OptKeepHistory = True Then
MsgBox "You chose to keep history"
End If
End Sub


Curt wrote:

Dave I will try to clarify better
I get view code from excel
VBA project
open Userform 1
click on toolbox
pull option button from toolbox
go to properties change nbr then to userforn and do same.
I think I did all right havent had time to check yet
Got ambigous name one time tho.
Must of missed changeing something
Thanks Again
Curt

"Dave Peterson" wrote:

There's a difference between creating a "form" on a worksheet and a userform
found inside the VBE--the userform inside the VBE would look a lot like the
dialog that you see when you use Tools|Options.

If they are optionbuttons from the Forms toolbar that are placed on the
worksheet, then you won't see "view code".

I think you'll have to clarify again.



Curt wrote:

These are on user form In the properties page at top it says name is this
what you mean by formula bar. When I view code and click on th option button
am asked to view code or properties. This is where I am ok. From forms
toolbar not active X controls. Useiong option explicd asked to declare
optionbutton1 not defined. Would all need to be defined. also defined as
what. All buttons have one thing to do. Ain't smart enought to do more than
one thing at a time.
Do know this many of those who volunteer for the Vet's Day parade are
looking forward for this program.
I can not express enough my gratuide to those of you who answer this forum.
Will expermint with names and see what happens.
Thank You

"Dave Peterson" wrote:

Are these on a worksheet or on a userform?

If they're on a worksheet, are they optionbuttons from the control toolbox
toolbar or from the Forms toolbar?

If you wanted a macro to do the renaming, the code would be different.

But since there's only 10 optionbuttons, you can do them manually.

You can select the optionbutton and then just type the new name in the namebox
(to the left of the formulabar).

If the optionbuttons are from the Control Toolbox toolbar, then you'll have to
be in design mode first.

As for naming them, you can choose any name that's valid. But if you're going
to refer to them later on, using something mnemonically significant would be
best.

But if you're using a linked cell to get the status, maybe it's not too
important -- I do like naming shapes based on their position in the worksheet:

OptBtn_A1

(if it's always in A1)

Curt wrote:

Thanks to all for smarting me up. Now I get it. Tried on one procedure and
found var not declared. Would someone advise as to what I should call a
option button. Also due to my learning curve. I have buttons numbered from
1-27. Is it possible to renumber these buttons as total i have maybe 10.
Thanks Again

"Dave Peterson" wrote:

I use it to debug my code. If there's a syntax error (or undeclared variable),
then I'll get errors in the compile.

You can read some notes by Don Baarns at about what compiling means to VBA:
http://archive.baarns.com/excel/develop/vbaperfm.asp

And if you're interested in cleaning your code, try Rob Bovey's code cleaner:
You can find it he
http://www.appspro.com/
or directly
http://www.appspro.com/Utilities/CodeCleaner.htm


Curt wrote:

Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


Curt

whats it do
 
Got down to this one for some reason I can not seem to find the right
combination
had no trouble renameing option buttons from your last
Thanks
Option Explicit
'Dim clearconstants As Variable

Sub clearconstants()

' clearConstants Macro
' Macro recorded 4/10/2007 by Default

'Sub ClearConstants(rng As Range)
Dim rngConstants As Range
'Dim rng As User defined
On Error Resume Next
Set rngConstants = rng.SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If Not rngConstants Is Nothing Then rngConstants.ClearContents
'End Sub

'
End Sub


"Curt" wrote:

Thanks Much Dave will proceed with more confidence.
Thanks Again
Will probably be back agaon
Curt

"Dave Peterson" wrote:

I understand!

Each control on that userform has to have a unique name--no duplicates.

Select any of the optionbuttons you want to change
Hit F4 to see the properties window
Look for a property called (Name) -- it includes the ()'s.
(It should be right near the top in either the Alphabetic or catorized tab)
Type the new name to the right of that property.

And to keep optionbuttons from being grouped with other optionbuttons, you can
either put each group in a frame--or give each group the same groupname.

======
Say you change the name of an optionbutton to OptKeepHistory, then you could
refer to it in (say) the Ok button's procedu

Option Explicit
Private Sub Ok_Click()
If Me.OptKeepHistory = True Then
MsgBox "You chose to keep history"
End If
End Sub


Curt wrote:

Dave I will try to clarify better
I get view code from excel
VBA project
open Userform 1
click on toolbox
pull option button from toolbox
go to properties change nbr then to userforn and do same.
I think I did all right havent had time to check yet
Got ambigous name one time tho.
Must of missed changeing something
Thanks Again
Curt

"Dave Peterson" wrote:

There's a difference between creating a "form" on a worksheet and a userform
found inside the VBE--the userform inside the VBE would look a lot like the
dialog that you see when you use Tools|Options.

If they are optionbuttons from the Forms toolbar that are placed on the
worksheet, then you won't see "view code".

I think you'll have to clarify again.



Curt wrote:

These are on user form In the properties page at top it says name is this
what you mean by formula bar. When I view code and click on th option button
am asked to view code or properties. This is where I am ok. From forms
toolbar not active X controls. Useiong option explicd asked to declare
optionbutton1 not defined. Would all need to be defined. also defined as
what. All buttons have one thing to do. Ain't smart enought to do more than
one thing at a time.
Do know this many of those who volunteer for the Vet's Day parade are
looking forward for this program.
I can not express enough my gratuide to those of you who answer this forum.
Will expermint with names and see what happens.
Thank You

"Dave Peterson" wrote:

Are these on a worksheet or on a userform?

If they're on a worksheet, are they optionbuttons from the control toolbox
toolbar or from the Forms toolbar?

If you wanted a macro to do the renaming, the code would be different.

But since there's only 10 optionbuttons, you can do them manually.

You can select the optionbutton and then just type the new name in the namebox
(to the left of the formulabar).

If the optionbuttons are from the Control Toolbox toolbar, then you'll have to
be in design mode first.

As for naming them, you can choose any name that's valid. But if you're going
to refer to them later on, using something mnemonically significant would be
best.

But if you're using a linked cell to get the status, maybe it's not too
important -- I do like naming shapes based on their position in the worksheet:

OptBtn_A1

(if it's always in A1)

Curt wrote:

Thanks to all for smarting me up. Now I get it. Tried on one procedure and
found var not declared. Would someone advise as to what I should call a
option button. Also due to my learning curve. I have buttons numbered from
1-27. Is it possible to renumber these buttons as total i have maybe 10.
Thanks Again

"Dave Peterson" wrote:

I use it to debug my code. If there's a syntax error (or undeclared variable),
then I'll get errors in the compile.

You can read some notes by Don Baarns at about what compiling means to VBA:
http://archive.baarns.com/excel/develop/vbaperfm.asp

And if you're interested in cleaning your code, try Rob Bovey's code cleaner:
You can find it he
http://www.appspro.com/
or directly
http://www.appspro.com/Utilities/CodeCleaner.htm


Curt wrote:

Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


Dave Peterson

whats it do
 
You used this:
set rngConstants = rng.specialcells(xlcelltypeconstants)

But you never told the code what rng was supposed to be?



Curt wrote:

Got down to this one for some reason I can not seem to find the right
combination
had no trouble renameing option buttons from your last
Thanks
Option Explicit
'Dim clearconstants As Variable

Sub clearconstants()

' clearConstants Macro
' Macro recorded 4/10/2007 by Default

'Sub ClearConstants(rng As Range)
Dim rngConstants As Range
'Dim rng As User defined
On Error Resume Next
Set rngConstants = rng.SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If Not rngConstants Is Nothing Then rngConstants.ClearContents
'End Sub

'
End Sub

"Curt" wrote:

Thanks Much Dave will proceed with more confidence.
Thanks Again
Will probably be back agaon
Curt

"Dave Peterson" wrote:

I understand!

Each control on that userform has to have a unique name--no duplicates.

Select any of the optionbuttons you want to change
Hit F4 to see the properties window
Look for a property called (Name) -- it includes the ()'s.
(It should be right near the top in either the Alphabetic or catorized tab)
Type the new name to the right of that property.

And to keep optionbuttons from being grouped with other optionbuttons, you can
either put each group in a frame--or give each group the same groupname.

======
Say you change the name of an optionbutton to OptKeepHistory, then you could
refer to it in (say) the Ok button's procedu

Option Explicit
Private Sub Ok_Click()
If Me.OptKeepHistory = True Then
MsgBox "You chose to keep history"
End If
End Sub


Curt wrote:

Dave I will try to clarify better
I get view code from excel
VBA project
open Userform 1
click on toolbox
pull option button from toolbox
go to properties change nbr then to userforn and do same.
I think I did all right havent had time to check yet
Got ambigous name one time tho.
Must of missed changeing something
Thanks Again
Curt

"Dave Peterson" wrote:

There's a difference between creating a "form" on a worksheet and a userform
found inside the VBE--the userform inside the VBE would look a lot like the
dialog that you see when you use Tools|Options.

If they are optionbuttons from the Forms toolbar that are placed on the
worksheet, then you won't see "view code".

I think you'll have to clarify again.



Curt wrote:

These are on user form In the properties page at top it says name is this
what you mean by formula bar. When I view code and click on th option button
am asked to view code or properties. This is where I am ok. From forms
toolbar not active X controls. Useiong option explicd asked to declare
optionbutton1 not defined. Would all need to be defined. also defined as
what. All buttons have one thing to do. Ain't smart enought to do more than
one thing at a time.
Do know this many of those who volunteer for the Vet's Day parade are
looking forward for this program.
I can not express enough my gratuide to those of you who answer this forum.
Will expermint with names and see what happens.
Thank You

"Dave Peterson" wrote:

Are these on a worksheet or on a userform?

If they're on a worksheet, are they optionbuttons from the control toolbox
toolbar or from the Forms toolbar?

If you wanted a macro to do the renaming, the code would be different.

But since there's only 10 optionbuttons, you can do them manually.

You can select the optionbutton and then just type the new name in the namebox
(to the left of the formulabar).

If the optionbuttons are from the Control Toolbox toolbar, then you'll have to
be in design mode first.

As for naming them, you can choose any name that's valid. But if you're going
to refer to them later on, using something mnemonically significant would be
best.

But if you're using a linked cell to get the status, maybe it's not too
important -- I do like naming shapes based on their position in the worksheet:

OptBtn_A1

(if it's always in A1)

Curt wrote:

Thanks to all for smarting me up. Now I get it. Tried on one procedure and
found var not declared. Would someone advise as to what I should call a
option button. Also due to my learning curve. I have buttons numbered from
1-27. Is it possible to renumber these buttons as total i have maybe 10.
Thanks Again

"Dave Peterson" wrote:

I use it to debug my code. If there's a syntax error (or undeclared variable),
then I'll get errors in the compile.

You can read some notes by Don Baarns at about what compiling means to VBA:
http://archive.baarns.com/excel/develop/vbaperfm.asp

And if you're interested in cleaning your code, try Rob Bovey's code cleaner:
You can find it he
http://www.appspro.com/
or directly
http://www.appspro.com/Utilities/CodeCleaner.htm


Curt wrote:

Have never used compile and haven't read any in my books. Do not understand
what it does. Have put together a program for parade. Don't know if compile
is something I should do to this or not.
any suggestions?
Thanks

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 10:32 PM.

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