ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to get the number of Line/Column used in Excel sheet ? (https://www.excelbanter.com/excel-programming/402556-how-get-number-line-column-used-excel-sheet.html)

bbnimda[_2_]

How to get the number of Line/Column used in Excel sheet ?
 
Hi All,

I'm using a VbScript for Outlook , and want to get informations about Excel
file (Number of line and Column used)

Tks

--
Knowlege grows when shared.

http://bensoft.miniville.fr/tra



Bob Phillips

How to get the number of Line/Column used in Excel sheet ?
 
Off the top

Dim XLApp As Object
Dim XLWB as Object
Dim NumRows As Long
Dim NumCols As Long

Set XLApp = CreateObject(Excel.Application")
Set XLWB = Workbooks.Open(Filename:="C:\test\filename.xls")

NumRows = XLWB.Worksheets(1).UsedRange.Rows.Count
NumCols = XLWB.Worksheets(1).UsedRange.Columns.Count

Set XLWB = Nothing
Set XLApp = Nothing

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"bbnimda" wrote in message
...
Hi All,

I'm using a VbScript for Outlook , and want to get informations about
Excel file (Number of line and Column used)

Tks

--
Knowlege grows when shared.

http://bensoft.miniville.fr/tra




bbnimda[_2_]

How to get the number of Line/Column used in Excel sheet ?
 
Hello Bob,

Great tks

Bye


"Bob Phillips" a écrit dans le message de news:
...
Off the top

Dim XLApp As Object
Dim XLWB as Object
Dim NumRows As Long
Dim NumCols As Long

Set XLApp = CreateObject(Excel.Application")
Set XLWB = Workbooks.Open(Filename:="C:\test\filename.xls")

NumRows = XLWB.Worksheets(1).UsedRange.Rows.Count
NumCols = XLWB.Worksheets(1).UsedRange.Columns.Count

Set XLWB = Nothing
Set XLApp = Nothing

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"bbnimda" wrote in message
...
Hi All,

I'm using a VbScript for Outlook , and want to get informations about
Excel file (Number of line and Column used)

Tks

--
Knowlege grows when shared.

http://bensoft.miniville.fr/tra







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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com