Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: vbCrLf, vbCr, vbLf --- Difference??

  1. #1
    Join Date
    20th April 2005
    Location
    Morgan Hill, CA, USA
    Posts
    37

    vbCrLf, vbCr, vbLf --- Difference??

    I have always used "vbCr" to cause a carriage return and line feed when writing my macros. I've tested "vbCrLf" and "vbLf", and the difference between the 3 of them eludes my understanding. Are they, in fact, identical??

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    13th August 2004
    Posts
    56

    Re: vbCrLf, vbCr, vbLf --- Difference??

    I think the vbCrLf is exactly the same as the two commands vbCr and vbLf. You might only want a carriage return one day or you might want both a carriage return and a line feed the next.

    Simple as that. i think.
    Only Smarties have the answer


  3. #3
    Join Date
    25th January 2003
    Location
    UK
    Posts
    2,745

    Re: vbCrLf, vbCr, vbLf --- Difference??

    Hi Cyberdude,

    Welcome to the forum.

    Just to add to Matt's comments - you can see a brief summary here.
    (Personally, I tend to use vbNewline)

    HTH
    Cross-poster? Read this: Cross-posters
    Struggling to use tags (including Code tags)? : Forum tags

  4. #4
    Join Date
    20th April 2005
    Location
    Morgan Hill, CA, USA
    Posts
    37

    Re: vbCrLf, vbCr, vbLf --- Difference??

    Thanx for the comments, Guys. The VBA Help shows the same list that you referenced, Matt. I was afraid there might be some sort of subtle difference that would come back to haunt me sometime. Somewhere recently I saw a comment that "vbCr" could somehow change a cell's characteristics to include "Wrap". I'm not sure how that would work, but it's that sort of (undocumented) subtle difference that I was wondering about. It's amazing how terse the Help can be sometimes. Thanx again for the assist.

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    26th January 2003
    Location
    UK
    Posts
    4,684

    Re: vbCrLf, vbCr, vbLf --- Difference??

    I am sure I will get a back lash for this but here goes!

    vbXXX statements are handed down from VB not VBA at all it is one of those crossed over this – Excel / VBA uses char(xx) to do the same thing, history have developed and programmes jumped from VB to also VBA and so on so the odd VB syntax popped up and funny enough works in VBA – I must say there are wicked syntax that is running in VB that can be used in VBA but Your never find it documented in VBA anywhere odd but true – this are what I call grey cross’s and hard but workable thus why the are vbXXX (vbScript syntax not VBA syntax)

    When You work in VB (Jack never does but …) then everything in that environment is constructed in VBA we kind of steal / borrow / convert / use what is already inside that application VBA and so in VB world these syntax subtle as they are count big time, in Excel nar go for it toss it in Your code and try it and if needs be the old find and replace will solve that and re-test and see if You have as You want – if not try again – see You jig what we have often and VBA is tolerant to this, VB is not quite so.

    Oh well bring on the onslaught of remarks for the errors in what jiuk has said – cant be that far out if at all

    jiuk

    Excel Video Tutorials / Excel Dashboards Reports


  6. #6
    Join Date
    20th April 2005
    Location
    Morgan Hill, CA, USA
    Posts
    37

    Re: vbCrLf, vbCr, vbLf --- Difference??

    Thanx for the thoughts, jiuk. You just might be right.
    SAB

    Excel Video Tutorials / Excel Dashboards Reports


  7. #7
    Join Date
    26th January 2003
    Location
    UK
    Posts
    4,684

    Re: vbCrLf, vbCr, vbLf --- Difference??

    Here are some examples i wote Click here for link page

    jiuk

    Excel Video Tutorials / Excel Dashboards Reports


  8. #8
    Join Date
    26th January 2003
    Location
    Derbyshire,UK
    Posts
    18,298

    Re: vbCrLf, vbCr, vbLf --- Difference??

    As Richie says, vbNewLine is far easier to remember!!
    Hope that Helps

    Roy

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

  9. #9
    Join Date
    20th April 2005
    Location
    Morgan Hill, CA, USA
    Posts
    37

    Re: vbCrLf, vbCr, vbLf --- Difference??

    Two comments:
    1) I've never seen the "square box" that was referred to, and I've been using vbCr for at least 5 years, and written several hundred macros,
    2) vbNewLine is considerably longer to type:
    " ..." & vbCr & vbCr
    vs
    " ..." & vbNewLine & vbNewLine
    to produce a double line feed. In fact I chose vbCr over VbCrLf for the same reason. I suppose as long as I don't see any adverse results, there's no reason to change.
    Thanx again, Guys!

    Excel Video Tutorials / Excel Dashboards Reports


  10. #10
    Join Date
    15th April 2003
    Location
    USA
    Posts
    7,380

    Re: vbCrLf, vbCr, vbLf --- Difference??

    The "square box" will usually appear when switching between Windows versions and Mac versions.
    Please do not U2U (private message) me directly for questions that should be posted to the forum; any such U2Us will be ignored.

Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Difference Between Vb And Vb.net
    By kenshin in forum Technical Issues Help
    Replies: 3
    Last Post: July 18th, 2007, 16:35
  2. Split vbCrLf String
    By jonny in forum EXCEL HELP
    Replies: 4
    Last Post: January 3rd, 2007, 21:19
  3. Replies: 1
    Last Post: July 22nd, 2006, 01:20
  4. Replies: 19
    Last Post: August 9th, 2005, 07:04
  5. Difference
    By roberth in forum EXCEL HELP
    Replies: 2
    Last Post: November 5th, 2004, 01:22

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
  •  
porno