Command Box can't pick up variable from cell value

melodramatic

Board Regular
Joined
Apr 28, 2003
Messages
180
Office Version
  1. 365
Platform
  1. Windows
First time I've seen this problem.

I'm using an ActiveX CommandBox, and in it, have set up a variable that is the value of a cell.

VBA Code:
Dim TXHBox As String
Dim EndRow As Long

TXHBox = Range("C2")
EndRow = Range("D2") + 7

Cell C2 is a calculated alpha-numeric code.
Cell D2 is a calculated numeric count.

For some reason, those variables won't pick up. I've created a MsgBox to let me know what it's picked up as the variables, and in both cases, it's blank.

But, I copied the entire coding from the CommandBox to a Macro, and it worked with no problem.

Is there a different way to look this up in Command Box? Or am I limited to picking up variables from cells in macros?

Thanks for your help!
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
There is a Command BUTTON and a Combo BOX, which of those are you dealing with?

And its not clear what you are trying to do.
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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