+ Reply to Thread
Results 1 to 9 of 9

syntax error

  1. #1
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    syntax error

    HI all,

    the below is giving error...i want to search String pattern RAV in the range.. RAV may be in any position in the cell value...
    for example... the word ravi is in multiple rows in the column like RAVIKUMAR, RAVI PRASAD like this...but i need to search for pattern 'RAVI' in all rows...



    If Range("B" & CStr(LSearchRow)).Value = "%RAVI%"

    can you please correct above syntax please....

  2. #2
    Forum Contributor
    Join Date
    06-07-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: syntax error

    Try like this

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: syntax error

    Quote Originally Posted by Thalassa View Post
    Try like this

    Please Login or Register  to view this content.
    Wow super thank you so much it works...

    I need another help...

    i want to add another condition like below...

    If Range("B" & CStr(LSearchRow)).Value Like "*RAVI*" & If Range("DE" & CStr(LSearchRow)).Value = "Available" Then

    but it says compile error....

    all i need to add another condition....


    thanks in advance...

  4. #4
    Forum Contributor
    Join Date
    06-07-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: syntax error

    Try

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: syntax error

    If LSearchRow is a Long (or integer) then you don't need: CStr(LSearchRow)

    Please Login or Register  to view this content.
    or:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: syntax error

    Quote Originally Posted by StevenM View Post
    If LSearchRow is a Long (or integer) then you don't need: CStr(LSearchRow)

    Please Login or Register  to view this content.
    or:
    Please Login or Register  to view this content.
    Wow superb..thank you all.....let you know once i implement...

  7. #7
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: syntax error

    thank you.....very much

  8. #8
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: syntax error

    Thanks thats works...but i have below code to copy the row to second sheet...

    is there any way to change below so that i can copy only certain columns only in the matching rows..not all columns required... Please help

    'Select row in Sheet1 to copy
    Rows(CStr(LSearchRow) & ":" & CStr(LSearchRow)).Select
    Selection.Copy

    'Paste row into Sheet2 in next row
    Sheets("Sheet2").Select
    Rows(CStr(LCopyToRow) & ":" & CStr(LCopyToRow)).Select
    ActiveSheet.Paste
    Last edited by onenessboy; 06-16-2012 at 11:39 AM.

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: syntax error

    We would love to continue helping with your query, but first, please take a few minutes to read the forum rules about proper thread titles/code tags and adjust accordingly...

    Also, no need to include the prior post in your reply as a quote unless it is neccesary for further understanding...it also creates thread clutter.

    Please send me a PM when you have completed the thread title update and this post will be removed.

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.


    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    HTH
    Regards, Jeff

+ 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