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??
vbCrLf, vbCr, vbLf --- Difference??
-
-
-
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.
-
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
-
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. :thanx:
-
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
-
-
Re: vbCrLf, vbCr, vbLf --- Difference??
Thanx for the thoughts, jiuk. You just might be right.
SAB :rock: -
-
Re: vbCrLf, vbCr, vbLf --- Difference??
As Richie says, vbNewLine is far easier to remember!!
-
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! -
Re: vbCrLf, vbCr, vbLf --- Difference??
The "square box" will usually appear when switching between Windows versions and Mac versions.
-
-
Re: vbCrLf, vbCr, vbLf --- Difference??
Try the example i gave and do not wrap text in the cell see whay happens
jiuk
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!