![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Join Date: Mar 2004
Posts: 15
|
I have opened a text file into a workbook.
If I insert a formula in the workbook =len(B2) it returns a value of 0 for cells where I don't see any text. However, in VBA when I do a len on the same cell I get a return of 252. Code:
Debug.Print Len(.Range("B2"))
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Admin Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,617
|
Odd. Having some difficulty baking up a replication to the issue.
Use the Application object's clean() and trim() functions. |
|
|
|
|
|
#3 |
|
Join Date: Mar 2004
Posts: 15
|
I found a work around.
Open the txt file Code:
strGrps = "C:\Whatever.txt"
Set myBk = myXlObj.Workbooks.Open(Filename:=strGrps)
Code:
strGrps = "C:\Whatever.xls"
myBk.SaveAs Filename:=strGrps, FileFormat:=xlWorkbookNormal
Weirdness. |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 9,090
|
That really is wierd but a nice workaround.
UALynn - - is the text file imported from some other software program, and if so what is that software program?
__________________
Tom Urtis |
|
|
|
|
|
#5 |
|
MrExcel MVP
Admin Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,617
|
That's not weird. It's the beauty of Excel!
Wrong thread eh. |
|
|
|
|
|
#6 | |
|
Join Date: Mar 2004
Posts: 15
|
Quote:
|
|
|
|
|
|
|
#7 |
|
MrExcel MVP
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 9,090
|
Thanks...good to know for future encounters with LN.
__________________
Tom Urtis |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|