1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Need help with VB script

Discussion in 'Business Applications' started by SkorpionKZ, Jan 21, 2013.

Thread Status:
Not open for further replies.
Advertisement
  1. SkorpionKZ

    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.
     
  2. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    6,592
    First Name:
    Hans
    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?
     
  3. SkorpionKZ

    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:(
     
  4. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    6,592
    First Name:
    Hans
    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)
     
  5. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    6,592
    First Name:
    Hans
    Here's a sample file, just press the button.

    The macro's are all there.
     

    Attached Files:

  6. SkorpionKZ

    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.
     
  7. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    6,592
    First Name:
    Hans
    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
     
  8. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    6,592
    First Name:
    Hans
    Have you tested my sample file?
     
  9. SkorpionKZ

    SkorpionKZ Thread Starter

    Joined:
    Jan 21, 2013
    Messages:
    7
    I'm sorry was away for couple days. will check it now
     
  10. SkorpionKZ

    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.
     
  11. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    6,592
    First Name:
    Hans
    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
     
  12. SkorpionKZ

    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?
     
  13. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    6,592
    First Name:
    Hans
    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?
     
  14. SkorpionKZ

    SkorpionKZ Thread Starter

    Joined:
    Jan 21, 2013
    Messages:
    7
    THANKS:)

    I did it now. It is working perfectly
     
  15. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    6,592
    First Name:
    Hans
    If you get stuck just holler :)

    and if it's solved don't forget to press the button 'Mark Solved'
     
  16. Sponsor

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 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1086249

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice