+ Reply to Thread
Results 1 to 5 of 5

Thread: Double use for one macro

  1. #1
    Registered User
    Join Date
    06-20-2010
    Location
    Paris, France
    MS-Off Ver
    Excel 2001
    Posts
    2

    Red face Double use for one macro

    Hello everyone, first thread here for me.

    Here's my problem :
    I have a list of about 700 words in English in a table. In a column I got the words in English, and in another one, I have the translation in French. I also created a column on the left of the table in order to use the RECHERCHEV function, so that in another sheet, it takes at random a word. I created a macro that gives me another word just by clicking on it, and when I click again, it gives me another word. What I want to do, is making a macro that would display a word the first time you click on it, and the second time, it will give you the translation. Then when you click a 3rd time on it, it would give you another word, and the translation, and on and on and on.

    I hope I made myself understood, since English isn't my native language :p

    Thanks in advance to everyone !
    Boris

  2. #2
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,225

    Re: Double use for one macro

    Structure your multi-function macro like so:

    1) Do a test on the WORD cell to make sure it is empty.
    2) If it is empty - run your existing macro to insert a word, exit sub.

    3) If it is NOT empty, check the DEFINITION cell to see if it is empty.
    4) If it is empty - run your new macro to insert a definition for the word that is in the WORD cell, exit sub

    5) If it is NOT empty, clear both the WORD cell and the DEFINITION cell, run your existing macro, exit sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-20-2010
    Location
    Paris, France
    MS-Off Ver
    Excel 2001
    Posts
    2

    Re: Double use for one macro

    Thanks for answering me !

    I'm quite getting what you're telling me, but there's one problem :p : I'm a newbie at VBA language, thus what you're telling me is understandable, but undoable :s.
    Can you please show me how to do that if you don't mind ?

    Thanks a lot !
    Boris

  4. #4
    Forum Contributor pierre08's Avatar
    Join Date
    02-16-2010
    Location
    Paris
    MS-Off Ver
    Excel 2003
    Posts
    164

    Re: Double use for one macro

    Hi Bobbyo,
    It'll be much easier to give a code if you can join your workbook.

  5. #5
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,225

    Re: Double use for one macro

    Sure, post your workbook with your sample data and existing macro and we'll look it over together.

    Click GO ADVANCED and use the paperclip icon to post up a desensitized copy of your workbook.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0