+ Reply to Thread
Results 1 to 7 of 7

Newbie Syntax Issue revisited

  1. #1
    Registered User
    Join Date
    08-03-2019
    Location
    Illinois
    MS-Off Ver
    Mac 14.7.7
    Posts
    17

    Newbie Syntax Issue revisited

    This is strange as I thought I had this working but today when I came back to work on it, it no longer worked. I am trying to look at a cell in Column B and see if it has a carriage return and then if it does I want it to trim out anything after the character return then display a message box with what is left. I have the code that I thought was working two weeks ago below. I'm assuming this is a simple syntax error but I don't know what might have changed. Any ideas?

    Please Login or Register  to view this content.
    p.s. the error I am getting is 'invalid procedure or argument" Thx.
    Last edited by Leith Ross; 08-17-2019 at 06:12 PM.

  2. #2
    Registered User
    Join Date
    08-03-2019
    Location
    Illinois
    MS-Off Ver
    Mac 14.7.7
    Posts
    17

    Re: Newbie Syntax Issue revisited

    I may have just figured out part of the issue. If I remove the 'or' portion and just stick with Chr(10) or Chr(13) then it works. But is there a way to make it work for both?

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Try this !


    As a beginner starter :

    PHP Code: 
    Sub Demo1()
    Dim T$
        
    Split(Split([B1].TextvbLf)(0), vbCr)(0)
        
    MsgBox IIf(= [B1].Text"Ok""CR or LF present" vbLf vbLf T), vbInformation"Check CR/LF"
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb

    Another demonstration from your initial code (for which you must use code tags or specific icon as per forum rules) :

    PHP Code: 
    Sub Demo0()
        
    Dim S$, T$, VL&
            
    S$ = "Ok"
            
    = [B1].Text
        
    For Each V In Array(vbCrvbLf)
            
    InStr(TV)
            If 
    L Then T Left(T1): "Text before char #" Asc(V) & " :" vbLf vbLf T
        Next
            MsgBox S
    vbInformation"Check CR/LF"
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: Newbie Syntax Issue revisited

    Administrative Note:

    Jadee77

    We would very much like to help you with your query, however you need to include code tags around your code. You have been reminded of this rule before.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    08-03-2019
    Location
    Illinois
    MS-Off Ver
    Mac 14.7.7
    Posts
    17

    Re: Newbie Syntax Issue revisited

    So sorry. Read that before going on vacation and forgot. I will do that on my next post.

  7. #7
    Registered User
    Join Date
    08-03-2019
    Location
    Illinois
    MS-Off Ver
    Mac 14.7.7
    Posts
    17

    Re: Newbie Syntax Issue revisited

    Thank you both. Got it solved using some of what you wrote.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Newbie syntax issue
    By Jadee77 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-03-2019, 03:50 PM
  2. Randbetween issue - Excel newbie!
    By g_hughes in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-14-2018, 09:25 AM
  3. [SOLVED] newbie - simple import - what could be issue?
    By hmm321 in forum Excel General
    Replies: 2
    Last Post: 07-22-2013, 01:41 AM
  4. Newbie Solver issue:
    By luclim in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-27-2013, 03:26 PM
  5. syntax issue.
    By bopsgtir in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-04-2012, 09:35 PM
  6. [SOLVED] Syntax Issue
    By Vladamir in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-30-2012, 10:36 AM
  7. Newbie syntax question
    By Nodles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2006, 11:15 AM

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