+ Reply to Thread
Results 1 to 11 of 11

Looking for VBA that will search for a list of words and add a logo if found

Hybrid View

kmckie Looking for VBA that will... 08-27-2012, 04:41 AM
taps Re: Looking for VBA that will... 08-27-2012, 06:18 AM
kmckie Re: Looking for VBA that will... 08-27-2012, 07:03 AM
taps Re: Looking for VBA that will... 08-27-2012, 11:55 AM
kmckie Re: Looking for VBA that will... 08-27-2012, 12:24 PM
taps Re: Looking for VBA that will... 08-27-2012, 12:31 PM
kmckie Re: Looking for VBA that will... 08-28-2012, 06:02 AM
taps Re: Looking for VBA that will... 08-28-2012, 06:42 AM
  1. #1
    Registered User
    Join Date
    08-21-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2010
    Posts
    6

    Looking for VBA that will search for a list of words and add a logo if found

    Hello,

    This is my first post so I hope I have followed the rules correctly.

    I am looking to create a macro that will search the workbook for list of specific words and if found add a logo to each sheet.

    If the words are then removed, I would like the macro to then remove the logo.

    Does anyone know how I can accomplish this?

    Thanks.

  2. #2
    Forum Contributor
    Join Date
    09-29-2011
    Location
    Kolkata, India
    MS-Off Ver
    Excel 2003/2007
    Posts
    182

    Re: Looking for VBA that will search for a list of words and add a logo if found

    Hi,

    Try below code in a command button and modify it accordingly. Hope it will guide you.
    Write "Logo" in cell A1. When you will press the command button it will insert a picture from below path. Check its name (say, Picture 10).
    Delete the word LOGO from A1 and again run the code. See the magic.

    
    If Range("A1").Value = "Logo" Then
    ActiveSheet.Pictures.Insert("http://www.google.co.uk/intl/en_uk/images/logo.gif").Select
    Else
    ActiveSheet.Shapes("Picture 10").Delete
    End If

  3. #3
    Registered User
    Join Date
    08-21-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Looking for VBA that will search for a list of words and add a logo if found

    Hi this helps a lot thanks!

    How can I expand this to look for more than 1 word?

    So if I want the logo to be added, if the word logo1, logo2 or even logo* existed then add or remove the picture?

  4. #4
    Forum Contributor
    Join Date
    09-29-2011
    Location
    Kolkata, India
    MS-Off Ver
    Excel 2003/2007
    Posts
    182

    Re: Looking for VBA that will search for a list of words and add a logo if found

    Hi,

    I have prepared the entire macro for your convenience. It is working exactly as you want.

    How macro works here:
    1. All pictures are deleted from all sheets (Excepts Macro sheet)
    2. It's searches key words (images, logo, pictures etc) given in Macro sheet A column in remaining sheets.
    3. If key words are found and pictures are not there then its add the picture else not.
    4. If key words are not found and pictures are there then its delete the pictures.

    If require I hope now you can modify it. Let me know how it works.

    Also note that, if you want to delete / add any shape from insert menu then picture type will be 1 instead of 13.
    Attached Files Attached Files
    Last edited by taps; 08-27-2012 at 11:57 AM.

  5. #5
    Registered User
    Join Date
    08-21-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Looking for VBA that will search for a list of words and add a logo if found

    This is really great thanks!

    I find however if I add a keyword, then the logo appears, however if I remove the keyword in sheet "1" the logo remains. Is it possible for the macro to then remove it?

    Again thanks for your help.

  6. #6
    Forum Contributor
    Join Date
    09-29-2011
    Location
    Kolkata, India
    MS-Off Ver
    Excel 2003/2007
    Posts
    182

    Re: Looking for VBA that will search for a list of words and add a logo if found

    Hi,

    The logic I have used is, if there is any key words among 4 (mentioned in Macro Sheet) and no pictures are there then it will add picture.
    Also if there is no key words among 4 and pictures are there then it will delete picture.

    Could you tell me the logic you are thinking. it will help me.

  7. #7
    Registered User
    Join Date
    08-21-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Looking for VBA that will search for a list of words and add a logo if found

    Hi,

    If I add the word "logo" to sheet "1" then the macro runs correcly and the picture appears.

    However if I then remove the word and re-run the macro the picture is still there.

    Is there a way that the macro would remove the picture after one of the keywords are removed?

    Thanks for all your help with this.

  8. #8
    Forum Contributor
    Join Date
    09-29-2011
    Location
    Kolkata, India
    MS-Off Ver
    Excel 2003/2007
    Posts
    182

    Re: Looking for VBA that will search for a list of words and add a logo if found

    Hmmmmm....strange!!!

    The macro should work. Because, what I have done is, initially the macro will deleted all pictures from all sheets (except Macro sheet).
    So, I am surprise if it is not working. But note that, the newly added word "logo" should be there in Macro sheet in A column. Otherwise it will not searched by macro. Try again please.

    Also, the macro is looking in only A column.
    Last edited by taps; 08-28-2012 at 06:46 AM.

  9. #9
    Registered User
    Join Date
    08-21-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Looking for VBA that will search for a list of words and add a logo if found

    Thanks, it seems to be if the keyword is added and the macro run, then the picture appears.

    However if I then remove the keyword and re-run the macro the picture remains when we would like it removed.

    When you run it after removing the word does the picture disappear?

    Thanks again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.6.0 RC 1