+ Reply to Thread
Results 1 to 2 of 2

Find the specific text and copy and paste in another cell only if true.

  1. #1
    Registered User
    Join Date
    10-07-2012
    Location
    MORADABAD,INDIA
    MS-Off Ver
    EXCEL 2003
    Posts
    2

    Find the specific text and copy and paste in another cell only if true.

    HELLO,
    I AM WORKING ON A EXCEL SHEET WITH A MACRO DESCRIBED BELOW BUT WHEN THE IT DOES NOT FINDS THE TEXT I SEARCH OR FIND, IT DISPALYS AN ERROR MESSAGE BOX.
    I WANT THAT IF THE SEARCHED TEXT IS NOT FOUND, THEN IT SHOULD DO NOTHING INSTEAD OF DISPLAYING THE ERROR MESSAGE BOX.
    I WANT TO ADD IF CONDITION TO MY MACRO BUT DON'T KNOW HOW TO DO IT BECAUSE I KNOW VERY LITTLE ABOUT MACROS.
    HERE IS THE MACRO I AM USING.
    Sub prejudicedatefinder()
    '
    ' prejudicedatefinder Macro
    '
    ' Keyboard Shortcut: Ctrl+t
    '
    ActiveWindow.SmallScroll Down:=45
    Cells.Find(What:="Order of Dismissal for Case", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
    :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
    False, SearchFormat:=False).Activate
    Selection.Copy
    Range("A14").Select
    ActiveSheet.Paste
    Range("B12").Select
    End Sub

  2. #2
    Forum Contributor
    Join Date
    10-02-2012
    Location
    Bumi Nusantara
    MS-Off Ver
    Excel 2010; Excel 2016
    Posts
    136

    Re: Find the specific text and copy and paste in another cell only if true.

    plese turn of your Caps Lock and add this code

    Sub prejudicedatefinder()
    on error goto exitsub

    [your code]

    exitsub:
    exit sub

    End Sub
    Last edited by dwint; 10-07-2012 at 03:17 AM.

+ 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