Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Xl2007 Conditional Constants
Does anybody know if there has been any additions to the built-in
conditional constants in Excel 2007? In particular, I'm hoping for one that distinguishes XL2007 from previous versions. TIA, josh |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Xl2007 Conditional Constants
Application.Version is what I've been using. Excel 2007 is Excel 12, and
Application.Version will return "12.0" in it. You can use that in a number of ways: If Left(Application.Version,2)="12" then 'in Excel 2007 Else 'not in Excel 2007 End IF or If Val(Application.Version) <12 Then 'not in Excel 2007 Else 'in Excel 2007 (or later) End If Practical example dealing with the 'stardard' test to find last used row in a column Dim LastUsedRow As Long If Val(Application.Version) <12 Then 'not in Excel 2007 LastUsedRow = Rows.Count Else 'in Excel 2007 (or later) LastUsedRow = Rows.CountLarge End If then you can use LastUsedRow like this later on without having to do further version testing: LastRowValue = Range("A" & LastUsedRow).End(xlUP).Value "Josh Sale" wrote: Does anybody know if there has been any additions to the built-in conditional constants in Excel 2007? In particular, I'm hoping for one that distinguishes XL2007 from previous versions. TIA, josh |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Xl2007 Conditional Constants
Thanks. I'm familiar with Application.Version. What I want is a
conditional constant so I can write something like: #If VBA12 Then ..... #End If So that the compiler won't even try to compile the enclosed code on earlier versions of Excel. j "JLatham" <HelpFrom @ Jlathamsite.com.(removethis) wrote in message ... Application.Version is what I've been using. Excel 2007 is Excel 12, and Application.Version will return "12.0" in it. You can use that in a number of ways: If Left(Application.Version,2)="12" then 'in Excel 2007 Else 'not in Excel 2007 End IF or If Val(Application.Version) <12 Then 'not in Excel 2007 Else 'in Excel 2007 (or later) End If Practical example dealing with the 'stardard' test to find last used row in a column Dim LastUsedRow As Long If Val(Application.Version) <12 Then 'not in Excel 2007 LastUsedRow = Rows.Count Else 'in Excel 2007 (or later) LastUsedRow = Rows.CountLarge End If then you can use LastUsedRow like this later on without having to do further version testing: LastRowValue = Range("A" & LastUsedRow).End(xlUP).Value "Josh Sale" wrote: Does anybody know if there has been any additions to the built-in conditional constants in Excel 2007? In particular, I'm hoping for one that distinguishes XL2007 from previous versions. TIA, josh |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Xl2007 Conditional Constants
Josh,
There is no such conditional compilation constant. At compile time, there is no way to determine what version of Excel you are using. There is, of course, the VBA6 compiler constant, but that applies to everything since 2000. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Josh Sale" <jsale@tril dot cod wrote in message ... Thanks. I'm familiar with Application.Version. What I want is a conditional constant so I can write something like: #If VBA12 Then ..... #End If So that the compiler won't even try to compile the enclosed code on earlier versions of Excel. j "JLatham" <HelpFrom @ Jlathamsite.com.(removethis) wrote in message ... Application.Version is what I've been using. Excel 2007 is Excel 12, and Application.Version will return "12.0" in it. You can use that in a number of ways: If Left(Application.Version,2)="12" then 'in Excel 2007 Else 'not in Excel 2007 End IF or If Val(Application.Version) <12 Then 'not in Excel 2007 Else 'in Excel 2007 (or later) End If Practical example dealing with the 'stardard' test to find last used row in a column Dim LastUsedRow As Long If Val(Application.Version) <12 Then 'not in Excel 2007 LastUsedRow = Rows.Count Else 'in Excel 2007 (or later) LastUsedRow = Rows.CountLarge End If then you can use LastUsedRow like this later on without having to do further version testing: LastRowValue = Range("A" & LastUsedRow).End(xlUP).Value "Josh Sale" wrote: Does anybody know if there has been any additions to the built-in conditional constants in Excel 2007? In particular, I'm hoping for one that distinguishes XL2007 from previous versions. TIA, josh |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Xl2007 Conditional Constants
Thanks Chip.
I figured that was the case ... |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Xl2007 Conditional Constants
You can't, it is not an conditional constant.
-- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Josh Sale" <jsale@tril dot cod wrote in message ... Thanks. I'm familiar with Application.Version. What I want is a conditional constant so I can write something like: #If VBA12 Then ..... #End If So that the compiler won't even try to compile the enclosed code on earlier versions of Excel. j "JLatham" <HelpFrom @ Jlathamsite.com.(removethis) wrote in message ... Application.Version is what I've been using. Excel 2007 is Excel 12, and Application.Version will return "12.0" in it. You can use that in a number of ways: If Left(Application.Version,2)="12" then 'in Excel 2007 Else 'not in Excel 2007 End IF or If Val(Application.Version) <12 Then 'not in Excel 2007 Else 'in Excel 2007 (or later) End If Practical example dealing with the 'stardard' test to find last used row in a column Dim LastUsedRow As Long If Val(Application.Version) <12 Then 'not in Excel 2007 LastUsedRow = Rows.Count Else 'in Excel 2007 (or later) LastUsedRow = Rows.CountLarge End If then you can use LastUsedRow like this later on without having to do further version testing: LastRowValue = Range("A" & LastUsedRow).End(xlUP).Value "Josh Sale" wrote: Does anybody know if there has been any additions to the built-in conditional constants in Excel 2007? In particular, I'm hoping for one that distinguishes XL2007 from previous versions. TIA, josh |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Usiing a formula to Conditional Format XL2007 | New Users to Excel | |||
Conditional Formatting on a Row - XL2007 | New Users to Excel | |||
Conditional Formats XL2007 | Excel Discussion (Misc queries) | |||
Conditional Formatting in XL2007 | Excel Worksheet Functions | |||
Conditional formatting different on XL2007 than XL2003 | Excel Discussion (Misc queries) |