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
Solved

How do I inject VBA into Excel?

Posted on 2011-09-06
12
447 Views
Last Modified: 2012-05-12
I need to use existing code that populates a combo box in Excel, but am not sure where or how to add the code.

Can anyone tell me?

Thanks.
0
Comment
Question by:newbieweb
12 Comments
 
LVL 46

Accepted Solution

by:
Martin Liss earned 200 total points
ID: 36491863
Click the little 'Visual basic editor' button that you'll find to the right of the 'Securiy…' menu item.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 36491869
After that it's pretty much like VB6 if you're familiar with it.
0
 

Author Comment

by:newbieweb
ID: 36491902
Sorry, I forgot to say Excel 2007. And what tab do I select?
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:newbieweb
ID: 36491912
Is it the View Code button?
0
 

Author Comment

by:newbieweb
ID: 36491934
If so, please explain the various Microsoft Excel Object...
0
 
LVL 81

Assisted Solution

by:byundt
byundt earned 150 total points
ID: 36491936
If you are using a Forms toolbar combobox, the code goes in a regular module. Use the Insert...Module menu item in the VBA Editor to create a regular module sheet if you don't have one.

If you are using an Active-X combobox, the code goes in the code pane for the worksheet. Right-click the sheet tab and choose View Code to expose that code pane.
0
 
LVL 24

Assisted Solution

by:StephenJR
StephenJR earned 150 total points
ID: 36491949
For an ActiveX control, yes. Is it in the sheet or on a form?
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 36491962
0
 

Author Comment

by:newbieweb
ID: 36491976
I intend to use the VBA in this link:

http://datapigtechnologies.com/blog/index.php/recordset-tricks-in-excel-1-filling-a-combobox-with-unique-values/

to fill the combo from another Excel file. Then I plan to edit it to also read the data from a database.

I am not sure where to put that data.
0
 

Author Comment

by:newbieweb
ID: 36492059
The link talks about using an Active X control.

> Is it in the sheet or on a form?

It's on the sheet, not a form.

Those tiff's do not look anythin like my Excel, which is 2007. Am I missing something?
0
 

Author Comment

by:newbieweb
ID: 36492075
BUT, I do not want this any more complicated than necessary. I just want to move the contents of a combo box to outside of the Excel, first to another Excel, then to a database. If you have an easier way, please be my guest.
0
 

Author Closing Comment

by:newbieweb
ID: 36496421
Thanks.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

808 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