Need help with VB script

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

SkorpionKZ

Thread Starter
Joined
Jan 21, 2013
Messages
7
Hi guys, I have spreadsheet with few tabs and Macros. I need to create Scrip which will create Button on below conditions:

1. Position of the button:
- TabName: Conditions
- Cells: G4-G5
2. Name on the Button: Prepare

After button will be pressed I need Script to do bellow actions:

1. Check if Spreadsheet have any not hidden tabs with names: EA, EAS, EA MSQ, EAS MSQ. If so they need to be hidden.
2. Check if Spreadsheet have any hidden or not hidden tabs with names: EA (2), EAS (2), EA MSQ (2), EAS MSQ (2). If so they need to be deleted.
3. Massage should pop up: "Please select Program:" and there should be 4 choices: E3 EA , E3 EAS, MSQ EA, MSQ EAS.
4. Each of choice should start related Macros: E3_EA , E3_EAS, MSQ_EA, MSQ_EAS

If some one will create script for this, please explain how to add it to my Spreadsheet

Thank you in advance.
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,612
Hi, which version of Excel are you using?
Have you tried recording a macro and adding a button? You can then link the macro to that button.
But ... which versio of Excel are you using?
The related Macros: E3_EA , E3_EAS, MSQ_EA, MSQ_EAS, do they already exist?
by tabs I assume you mean sheets and can the ... (2) be hidden sheets as well?
 

SkorpionKZ

Thread Starter
Joined
Jan 21, 2013
Messages
7
I am using Office 2010.
Yes macros I mentioned already exists and yes tabs I mean sheets:)
... (2) should not be hidden, but if someone will hide it, then need to be deleted as well.

To be honest, I never tried to add button. I can create complex formulas and macros, but buttons is the thing I never tried:(
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,612
You can add a button by selecting the Developper menu (Ribbon) and select Insert
If you can attach a copy of the file (no private date please) you have I'll do it for you (with the macro's)
 

SkorpionKZ

Thread Starter
Joined
Jan 21, 2013
Messages
7
Website does not allow me to upload the files.

here is the link to the file:
http://turbobit.net/1g9o7bdhco13.html
I cleared all sheets, from private info, so don't know if macros will work, but if you will add button with actions I asked earlier i'll add all necessary information to updated Spreadsheet.
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,612
I cannot access the file with the link you posted.
What website doesn't allow you to upload files?
If it's too big, pack it TSG has no problems with uploads as long as the size is not exceeded
 

SkorpionKZ

Thread Starter
Joined
Jan 21, 2013
Messages
7
Your sample looks good. Few questions:)
1. Why there is button to create button?
2. How can I copy this Button and script to my sheet

My file is to big so I can't attached this.
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,612
You do not have to copy the button, you have to copy the underlying VBA code and run this a a macro, the button I put to show how it could work too
 

SkorpionKZ

Thread Starter
Joined
Jan 21, 2013
Messages
7
Don't know how to move this all script to my spreadsheet:(
Not sure if I understood it well, but it looks like that Button on Sheet1 doing all clearance I asked and button on Condition is starting one of my macros.
Is there is chance to have it all under same button?
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,612
Like I said, since you already have macros it shouldn't be that hard for you to copy one to the other.
Open both files, open the VBA project and just drag the macro into your project.
The button you can just create using tyhe developer tab (I explained that) and then attach the macro to it.
The macro that is linked to the created button is the one you need becasue I used the names of the macro's you posted.
A little self thinking now that you have the tools shouldn't be that difficult?
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,612
If you get stuck just holler :)

and if it's solved don't forget to press the button 'Mark Solved'
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top