Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,365
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default Xl2007 Conditional Constants

Thanks Chip.

I figured that was the case ...




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default 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
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
Usiing a formula to Conditional Format XL2007 Steve[_20_] New Users to Excel 1 January 30th 10 04:53 PM
Conditional Formatting on a Row - XL2007 Steve[_20_] New Users to Excel 2 January 17th 10 01:26 PM
Conditional Formats XL2007 Telford Tom[_2_] Excel Discussion (Misc queries) 1 November 21st 09 12:13 PM
Conditional Formatting in XL2007 Steve Haack Excel Worksheet Functions 3 August 3rd 08 05:27 PM
Conditional formatting different on XL2007 than XL2003 Stan Excel Discussion (Misc queries) 0 July 16th 08 06:24 PM


All times are GMT +1. The time now is 10:34 PM.

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"