Solved

Excel VBA - Not seeing code behind the worksheet

Posted on 2013-06-18
9
3,713 Views
Last Modified: 2013-06-20
Hi:

I need to debug a legacy Excel VBA application with several worksheets. I open the VB editor, turn on Design Mode, right click on the sheet I want to debug in the Project panel on the left and choose 'View Code", nothing shows up. No even a dialog asking for password.

What have I missed?

Thanks.
0
Comment
Question by:sdc248
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 12

Expert Comment

by:Alan3285
ID: 39258003
Hi,

Perhaps the code is in a module rather than in one specific sheet?

In the VB Editor, scroll through the list of sheets on the left, and see if there are any modules listed there.

Also, could be in the workbook itself, rather than a specific sheet?

Alan.
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39258049
Did you click the yellow security message bar allowing content to run? If not no code will be visible.
0
 

Author Comment

by:sdc248
ID: 39259764
Hi Alan:
There is a module with the method now confirmed by my colleague to be the method triggered by clicking the button. But does this work? From my limited knowledge about VBA, there should be a xxxOnClick() method that listens to the OnClick event.

Hi MacroShadow:
I don't see any yellow security message bar. I am using Excel 2007, by the way. Could it be version differences?
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 27

Expert Comment

by:MacroShadow
ID: 39260095
Do you get an error message when you click the command button?
0
 

Author Comment

by:sdc248
ID: 39260567
No. It just executes the code behind and displays the result on a separate worksheet.

From what I know, in design mode, double click the button would give me the code behind it. But I just can't get that to happen.
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39260624
That's weird. Are you dealing with controls on UserForms or in the Worksheets?
0
 

Author Comment

by:sdc248
ID: 39260940
Worksheets.
0
 
LVL 12

Accepted Solution

by:
Alan3285 earned 500 total points
ID: 39261200
Hi,

Make sure the botton is not selected (click on a cell somewhere in the worksheet say), then right-click on the command button, and select 'assign macro'.

Click on the macro name in the list, and then 'Edit' on the right hand side.

That will take you to the module or wherever the code is (in the VB Editor).

From there, copy and paste the code to here, and let us know what it does, and what you want it to do instead.

Thanks,

Alan.
0
 

Author Closing Comment

by:sdc248
ID: 39262889
That answers my question. Now I see how to track the method being called on clicking the button. I can take it from here. Thanks, Alan.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
modify formula for range changes 8 31
NEED TO DO 2 OR 3 OR 4 NUMBERS LOOK UP 2 23
move line without macro or copy/paste 6 45
need help to look for 16 42
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question