Can I DIM this?

jcassmyria

New Member
Joined
Dec 18, 2013
Messages
17
I need to DIM B$row# (example:B$1983) as a variable to use in a formula. How do I code this?

Thanks!
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
I need to DIM B$row# (example:B$1983) as a variable to use in a formula. How do I code this?
No, the # sign is an illegal character in a variable name and, if you meant the # sign to be part of the name, it too is illegal (a # sign can legitimately be located where you show it, but it is not part of the variable's name, rather, it is a type declaration character indicating the variable is a Double). Here are the naming rules for procedures, constants, variables, and arguments in a Visual Basic module as taken from the VB help files...

Use the following rules when you name procedures, constants, variables, and arguments in a Visual Basic module:

  • You must use a letter as the first character.


  • You can't use a space, period (.), exclamation mark (!), or the characters @, &, $, # in the name.


  • Name can't exceed 255 characters in length.


  • Generally, you shouldn't use any names that are the same as the functions, statements, and methods in Visual Basic. You end up shadowing the same keywords in the language. To use an intrinsic language function, statement, or method that conflicts with an assigned name, you must explicitly identify it. Precede the intrinsic function, statement, or method name with the name of the associated type library. For example, if you have a variable called <code>Left</code>, you can only invoke the Left function using <code>VBA.Left</code>.


  • You can't repeat names within the same level of scope. For example, you can't declare two variables named <code>age</code> within the same procedure. However, you can declare a private variable named <code>age</code> and a procedure-level variable named <code>age</code> within the same module. Note Visual Basic isn't case-sensitive, but it preserves the capitalization in the statement where the name is declared.
 
Last edited:
Upvote 0
Basically what I'm asking is can I DIM a cell address where the row is kept constant? I then want to use this variable in a formula.
 
Upvote 0
Code:
Const iRowB As String = "B$1983"

Range("A1").Formula = "=" & iRowB
 
Upvote 0

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top