03 to 07 function update

M

Martin Wheer

Below is the code I am using in 2003 vba. It does not work in 2007.

Dim wks As Worksheet
If Left(wks.Name, 1) = "R" Then - 07 does not like Left

end if

I tried finding the correct function on 2007 but got no where with it. Any
help would be greatly appreciated.
Ta,
Martin
 
P

Patrick Molloy

as given, the wks object hasn't been set to a worksheet

if you add for example
Set wks = ActiveSheet
it works fine:

Dim wks As Worksheet
Set wks = ActiveSheet
If Left(wks.Name, 1) = "R" Then
'do something
End If
 
M

Martin Wheer

Hi,
Thanks for the help.
Ta,
Martin

Patrick Molloy said:
as given, the wks object hasn't been set to a worksheet

if you add for example
Set wks = ActiveSheet
it works fine:

Dim wks As Worksheet
Set wks = ActiveSheet
If Left(wks.Name, 1) = "R" Then
'do something
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top