PC Review


Reply
Thread Tools Rate Thread

Code not working in Excel 11

 
 
=?Utf-8?B?TWFyaw==?=
Guest
Posts: n/a
 
      10th Nov 2006
I have the following snippet of code which when run in Excel 10 works fine,
but for some reason doesn't work in Excel 11. Can anyone offer any solutions
for this please?

I have a form which users input a number as a string lets says it's "1150"

This is the part that doesn't work - it doesn't activate the respective
workbook

Workbooks(AName & " - (1000-1999)").Activate


SNIPPET

AName = Left(ActiveWorkbook.Name, 14)

ControlBook = ActiveWorkbook.Name

On Error GoTo NewBadge

If IsNumeric(BadgeNumber) Then
lBadge = CLng(BadgeNumber)
Select Case lBadge
Case 1 To 1000

Workbooks(AName & " - (1000-1999)").Activate

' this on error causes a fail to find to go to create a new record
Worksheets(BadgeNumber).Activate
Application.StatusBar = "You are now editing " + BadgeNumber + "'s "
+ AName + " record...."

etc....
--
Mark
 
Reply With Quote
 
 
 
 
Jon Peltier
Guest
Posts: n/a
 
      10th Nov 2006
There's no extension suffix on the workbook name (.xls). Did your Windows
settings change? Default in Windows (a stupid choice if you ask me and
thousands of others) is not to show the extension for known file types. If
the setting changes, your workbook name is insufficient to find the workbook
you want. What's the error message, by the way?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Mark" <(E-Mail Removed)> wrote in message
news:F745142B-06A0-47F6-BA26-(E-Mail Removed)...
>I have the following snippet of code which when run in Excel 10 works fine,
> but for some reason doesn't work in Excel 11. Can anyone offer any
> solutions
> for this please?
>
> I have a form which users input a number as a string lets says it's "1150"
>
> This is the part that doesn't work - it doesn't activate the respective
> workbook
>
> Workbooks(AName & " - (1000-1999)").Activate
>
>
> SNIPPET
>
> AName = Left(ActiveWorkbook.Name, 14)
>
> ControlBook = ActiveWorkbook.Name
>
> On Error GoTo NewBadge
>
> If IsNumeric(BadgeNumber) Then
> lBadge = CLng(BadgeNumber)
> Select Case lBadge
> Case 1 To 1000
>
> Workbooks(AName & " - (1000-1999)").Activate
>
> ' this on error causes a fail to find to go to create a new record
> Worksheets(BadgeNumber).Activate
> Application.StatusBar = "You are now editing " + BadgeNumber + "'s
> "
> + AName + " record...."
>
> etc....
> --
> Mark



 
Reply With Quote
 
=?Utf-8?B?TWFyaw==?=
Guest
Posts: n/a
 
      10th Nov 2006
Many thanks, I'll try it out.

No error message just puts a new sheet with the details in the wrong
workbook for that particular number.
--
Mark


"Jon Peltier" wrote:

> There's no extension suffix on the workbook name (.xls). Did your Windows
> settings change? Default in Windows (a stupid choice if you ask me and
> thousands of others) is not to show the extension for known file types. If
> the setting changes, your workbook name is insufficient to find the workbook
> you want. What's the error message, by the way?
>
> - Jon
> -------
> Jon Peltier, Microsoft Excel MVP
> Tutorials and Custom Solutions
> http://PeltierTech.com
> _______
>
>
> "Mark" <(E-Mail Removed)> wrote in message
> news:F745142B-06A0-47F6-BA26-(E-Mail Removed)...
> >I have the following snippet of code which when run in Excel 10 works fine,
> > but for some reason doesn't work in Excel 11. Can anyone offer any
> > solutions
> > for this please?
> >
> > I have a form which users input a number as a string lets says it's "1150"
> >
> > This is the part that doesn't work - it doesn't activate the respective
> > workbook
> >
> > Workbooks(AName & " - (1000-1999)").Activate
> >
> >
> > SNIPPET
> >
> > AName = Left(ActiveWorkbook.Name, 14)
> >
> > ControlBook = ActiveWorkbook.Name
> >
> > On Error GoTo NewBadge
> >
> > If IsNumeric(BadgeNumber) Then
> > lBadge = CLng(BadgeNumber)
> > Select Case lBadge
> > Case 1 To 1000
> >
> > Workbooks(AName & " - (1000-1999)").Activate
> >
> > ' this on error causes a fail to find to go to create a new record
> > Worksheets(BadgeNumber).Activate
> > Application.StatusBar = "You are now editing " + BadgeNumber + "'s
> > "
> > + AName + " record...."
> >
> > etc....
> > --
> > Mark

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple VBA Code Working in Excel 2007 but not Excel 2003 #N/A KMH Microsoft Excel Programming 1 3rd Mar 2010 09:25 AM
Code not working in Excel 2007 abajo Microsoft Excel Programming 1 23rd Jun 2009 10:20 AM
Simple VBA Code written in Excel 2003 not working in Excel 2000 =?Utf-8?B?UmljaCBCLg==?= Microsoft Excel Programming 4 3rd Aug 2007 04:36 PM
Excel 2000 VBA Code not working in Excel 2002 OldGuy Microsoft Excel Programming 1 6th Aug 2004 06:26 AM
Excel 2000 code not working in XP Shane J Microsoft Excel Programming 2 31st Jan 2004 03:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:16 AM.