MrExcel Message Board


Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Oct 18th, 2007, 12:57 AM   #1
edvwvw
 
Join Date: Jan 2007
Posts: 208
Default VBA Constant

Is there any way that I can change a constant in VBA

Option Explicit
Const MaxAccuracy = 0.00001
Const MaxLoops = 100
Constant Reset = 900

I want to be able to change the Reset constant to 900 or 3600.

The variable is called over 20 times within the code so if possible I would rather use the Option Explicit rather than make all of the entries using Public Function for each area of the module.

Any help would be greatly appreciated - thanks

edvwvw
edvwvw is offline   Reply With Quote
Old Oct 18th, 2007, 10:30 AM   #2
Lewiy
 
Lewiy's Avatar
 
Join Date: Jan 2007
Location: Hyrule
Posts: 3,978
Default

If you have a value that you want to change throughout the code, why don’t you just declare it as a variable rather than a constant?

FYI – Option Explicit just forces all variables and constants to be declared. It has no bearing on where or how they are defined.
__________________
Work fascinates me........I could sit and watch it for hours!
Lewiy is offline   Reply With Quote
Old Oct 18th, 2007, 10:48 AM   #3
edvwvw
 
Join Date: Jan 2007
Posts: 208
Default

Thanks - I will try that instead

edvwvw
edvwvw is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT +1. The time now is 12:44 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2009 by MrExcel Consulting.