PC Review


Reply
Thread Tools Rate Thread

Check number of rows?

 
 
=?Utf-8?B?RGF2aWQgQmlsbGlnbWVpZXI=?=
Guest
Posts: n/a
 
      21st Feb 2007
I currently have the following code set up which displays a message box if
the csv I'm importing has greater than 256 fields. Is there a way to also
check if the csv has greater than 65,536 rows?

fileLocation = Application.GetOpenFilename("ASCII
(*.csv;*.txt;*.dat),*.csv;*.txt;*.dat,All Files (*.*),*.*")

filein = FreeFile()
Open fileLocation For Input As filein
Line Input #filein, l
If (Len(l) - Len(Replace(l, ",", "")) > 255) Then
MsgBox ("Cannot import, input file has more than 256 fields")
Exit Sub
End If


Thanks

--
Regards,
Dave
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      21st Feb 2007
1)loop through it and count the number of rows.

2)read it all at once into one variable and count the number of VbCRLF

do 2, then use split to put it in a variable. check the Ubound

--
Regards,
Tom Ogilvy



"David Billigmeier" wrote:

> I currently have the following code set up which displays a message box if
> the csv I'm importing has greater than 256 fields. Is there a way to also
> check if the csv has greater than 65,536 rows?
>
> fileLocation = Application.GetOpenFilename("ASCII
> (*.csv;*.txt;*.dat),*.csv;*.txt;*.dat,All Files (*.*),*.*")
>
> filein = FreeFile()
> Open fileLocation For Input As filein
> Line Input #filein, l
> If (Len(l) - Len(Replace(l, ",", "")) > 255) Then
> MsgBox ("Cannot import, input file has more than 256 fields")
> Exit Sub
> End If
>
>
> Thanks
>
> --
> Regards,
> Dave

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count number of rows, where non relevant rows are hidden =?Utf-8?B?UGlldGVy?= Microsoft Excel Misc 2 8th Nov 2006 12:24 PM
Get number of rows that data takes up, including blank rows =?Utf-8?B?RGVuaGFtIENvb3Rl?= Microsoft Excel Worksheet Functions 4 21st Aug 2006 09:18 AM
Get number of rows that data takes up, including blank rows =?Utf-8?B?RGVuaGFtIENvb3Rl?= Microsoft Excel Worksheet Functions 0 18th Aug 2006 12:25 PM
How do I check the number of rows selected dpatwary@gmail.com Microsoft Excel Programming 4 8th Aug 2006 01:27 PM
flexible paste rows function that inserts the right number of rows =?Utf-8?B?bWFyaWthMTk4MQ==?= Microsoft Excel Misc 1 18th Feb 2005 02:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:38 AM.