Assigning string "AJ" to a variable in VBA is not working. why ?

Navin8211

New Member
Joined
Aug 11, 2023
Messages
1
Office Version
  1. 2013
Platform
  1. Windows
Hello, I am trying to assign a strong "AJ" to a variable in VBA. After executing the code, I am getting an empty variable.

I am assigning like below,
Var1="AJ"

This AJ is actually referring to 'AJ' column in another tab of the Excel sheet. Please do provide some insights on how to tackle this problem. Thank you in advance.
 
Should also avoid variable names that are the same as cell references
 
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
@Dennis S, I am not sure everyone is on the same page here but I can replicate what you are seeing when you use AJ in caps and hover over the variable.
It doesn't seem to make any difference whether the variable is all lowercase or not.
I also get the same result using your rowALPHA = LCase(Split(Cells(1, 36).Address, "$")(1))

I can see the value in the debug.print output and in the watch window as was also the case for you.

I am not able to replicate that when you put it into a formula that it doesn't output in the formula. Happy to test this as well if you provide the line that is failing at your end.

1701325120880.png

PS: For context I am on MS365 Version 2310 (Build 16924.20150) - although since you have seen the issue reported since 2019 it is unlikely to be version specific.
 
Upvote 0
I can get the same result with Version 2311 16.0.17029.20028 64-bit.

Locals, Watch, debug.print, msgbox not affected, just the tooltip for me doesn't display with "AJ" or "AJONES" (lowercase and mixed case (see edit below) does display for me, the Variable name is making no difference)

Edit: I do get the same issue with "AJones" not "Ajones"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,237
Messages
6,123,800
Members
449,127
Latest member
Cyko

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