Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Check number of rows?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Check number of rows?

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I check the number of rows selected [email protected] Excel Programming 4 August 8th 06 01:27 PM
Check if sheet name is a number linglc Excel Programming 1 July 13th 06 04:13 AM
Check if sheet's name is a number linglc Excel Discussion (Misc queries) 1 July 13th 06 01:48 AM
how do I check if known number is in array Iain - T Excel Discussion (Misc queries) 6 January 30th 06 04:26 AM
Check for number courtesio99[_8_] Excel Programming 7 December 16th 03 03:19 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"