Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Is it correct to refer to a Dim statement as a variable? See the following
macro and comments: Sub ToggleInterestRate() Dim Toggle As String 'Defines Toggle as a variable Toggle = InputBox("Enter Y or N to toggle interest rate calculation") 'Defines the variable Toggle as equaling the value entered in the pop up. Worksheets(1).Range("A3").Value = Toggle 'Applies the value specified as Toggle in the cell A3 I guess what I'm asking is: is there ever a case where a Dim statement is NOT variable; i.e., is a constant? Dave -- A hint to posters: Specific, detailed questions are more likely to be answered than questions that provide no detail about your problem. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Dim is a keyword used to declare variables, and one cannot assign value
to the variable in the Dim statement. Constants are declared using the Const keyword, and *must* have a value assigned. Const csPASSWORD As String = "drowssap" Dim sPWORD As String sPWORD = csPASSWORD In article , Dave F wrote: Is it correct to refer to a Dim statement as a variable? See the following macro and comments: Sub ToggleInterestRate() Dim Toggle As String 'Defines Toggle as a variable Toggle = InputBox("Enter Y or N to toggle interest rate calculation") 'Defines the variable Toggle as equaling the value entered in the pop up. Worksheets(1).Range("A3").Value = Toggle 'Applies the value specified as Toggle in the cell A3 I guess what I'm asking is: is there ever a case where a Dim statement is NOT variable; i.e., is a constant? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks, that's helpful.
Dave -- A hint to posters: Specific, detailed questions are more likely to be answered than questions that provide no detail about your problem. "JE McGimpsey" wrote: Dim is a keyword used to declare variables, and one cannot assign value to the variable in the Dim statement. Constants are declared using the Const keyword, and *must* have a value assigned. Const csPASSWORD As String = "drowssap" Dim sPWORD As String sPWORD = csPASSWORD In article , Dave F wrote: Is it correct to refer to a Dim statement as a variable? See the following macro and comments: Sub ToggleInterestRate() Dim Toggle As String 'Defines Toggle as a variable Toggle = InputBox("Enter Y or N to toggle interest rate calculation") 'Defines the variable Toggle as equaling the value entered in the pop up. Worksheets(1).Range("A3").Value = Toggle 'Applies the value specified as Toggle in the cell A3 I guess what I'm asking is: is there ever a case where a Dim statement is NOT variable; i.e., is a constant? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If Statements | Excel Worksheet Functions | |||
IF Statements (Mutliple Statements) | Excel Worksheet Functions | |||
if and or statements | Excel Discussion (Misc queries) | |||
IF & AND statements | Excel Worksheet Functions | |||
If then statements | Excel Worksheet Functions |