Excel VB nightmare...help!

JeffWilson

New Member
Joined
Aug 24, 2002
Messages
3
I will try and explain this clearly. I have 2 workbooks that SHOULD be
identical. But in one if them, when I open the VB code display, I see
a bunch of variables in the left box (on the right hand side of the
screen) that are not in the other workbook. These are date fields that
I am using a date picker on. Now, the code is IDENTICAL in both
workbooks, but the variables only show in the drop down box on the one
book. On the other, the date picker is not working properly. Can
anyone make sense of this and tell me what the heck I did wrong? I
probably cut and pasted this stuff improperly. Thanks VERY much in
advance!
Jeff
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
There is no data validation on that cell. I am not sure what you mean by "activated" data validation. I do have some cells that have data validation in order to ahve a drop down box. But the "drop down box" that I refer to is the one that is on eht VB code screen..not in my workbook. There are 2 boxes, one with variable names and one with actions (i.e. click, open, etc.) The problem is that my variables are not showing up in this box, even tho there is code on that page that references the variables. Is that clear?? I hope so! Thanks!
Jeff
 
Upvote 0
Your variables won't show up in the left-hand dropdown (aka Object Box), only objects like workbooks, userforms, worksheets and controls on those objects will appear there when you are in the code module for the object. If you're in the code module for a procedure then the only thing shown will be General. Use the left-hand explorer pane to navigate between the various modules.

(A couple more examples, within a Worksheet code module, you'll have entries for General and Worksheet, changing the dropdown to read Worksheet will allow you to select the event procedures for the Worksheet from the right-hand dropdown, similarly for the ThisWorkbook module. Within a UserForm module, you'll have entries for the UserForm and all the controls you've placed upon it, again you can choose event procedures from the right-hand dropdown for each control. Within a standard code module, you'll only have General in the left-hand box, the right-hand box will list the names of all the procedures within the moduel. HTH.)
 
Upvote 0
Mudface,

Thanks..you certainly understand what I was trying to say! I think the problem is that the show up in one book, but not the other. Which means that maybe they are setup as CONTROLS in one, but not the other? I just checked futher, and in the one book the controls show up in the left box as xxxx and in the other they show up in the right as xxxx_Change. Does this make sense to you, because it sure doesn't to ME! Thanks again for your help!
Jeff
 
Upvote 0
It sounds like you've copied and pasted the code in one workbook into the correct (UserForm or Worksheet?) module, which will give you a list of control names (eg TextBox1, CommandButton1) in the left-hand box. In the other workbook you appear to have pasted into a standard module, so the control names aren't listed in the left-hand box but their event procedures will show up in the right-hand box.

You'll need to cut out and paste the code in the second workbook into the correct code module (ie the same one as you used in the first workbook). Use the explorer pane on the left-hand side (you'll have a list of worksheets, ThisWorkbook, your userform if you have one and your other standard Modules). Double-click on each one to find out where your code is in the first workbook and put the code in your second workbook in the same place.
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,186
Members
448,554
Latest member
Gleisner2

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