Get workbook version

jstiene

Board Regular
Joined
Aug 5, 2005
Messages
223
How can I get the workbook version of an open workbook? The problem with 07 is you may have one workbook open as 07 and a million rows another in 97-03 with only 65,536 rows. So rather an doing an Excel down, is there a command in the object model telling me the last row possible in a workbook, for example, similar to

ActiveCell.SpecialCells(xlLastCell).Select

or

ActiveWorkbook.Application.Version

which only tells me the parent or ap version not the workbooks capabilities

I've run a few samples like

If ActiveWorkbook.Application.Version > 11 Then
' If Range("A65000").End(xlDown).Row > 66000 Then
Lrow = Sheets(WS1).Range("A105536").End(xlUp).Row
Lrow2 = Sheets(WS1).Range("A105536").End(xlUp).Row
Else
Lrow = Sheets(WS1).Range("A65536").End(xlUp).Row
Lrow2 = Sheets(WS1).Range("A65536").End(xlUp).Row
End If
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hello jstiene,

This will tell you how many rows there are in the worbook.
Code:
    ActiveWorkbook.Rows.Count
Sincerely,
Leith Ross
 
Upvote 0
Hello jstiene,

I made a typo in the previous post. It should be...
Rich (BB code):
    ActiveSheet.Rows.Count

Leith Ross
 
Upvote 0
You don't need the IF Then construct though:

Drop the 65536 entirely and switch to something like this:

Code:
Dim x as long
x=Range("A" & Rows.Count).End(xlUp).Row

then it will be compatible with both versions.
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,762
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top