PC Review


Reply
 
 
=?Utf-8?B?VG9t?=
Guest
Posts: n/a
 
      29th May 2007
Hi all,
I have a workbook with a fair amount of code written into it. I emailed
myself a copy of the workbook home on the weekend to work on it and kept
getting an error with one of the macros at home. I am (was) using the SAME
version of Excel - 2002 SP3 until I got completely frustrated and dropped the
$$$ for 2007 for my PC at home. Same problem.
The part of the code that is hanging is:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim sh As Worksheet, sh1 As Worksheet
Dim rng As Range, Cell As Range
Set rng = Worksheets("Main").Range("C8:C17")
If Not Intersect(Target, rng) Is Nothing Then
For Each sh1 In Worksheets
ERROR ---> bVisible = False
If LCase(sh1.Name) <> "main" Then
For Each Cell In rng
Set sh = Nothing
On Error Resume Next
Set sh = Worksheets(Cell.Value)
On Error GoTo 0
If Not sh Is Nothing Then
If sh.Name = sh1.Name Then
bVisible = True
Exit For
End If
End If
Next Cell
If bVisible Then
sh1.Visible = xlSheetVisible
Else
sh1.Visible = xlSheetHidden
End If
End If
Next sh1
End If
End Sub

Any ideas on how to fix this issue? It seems that the same libraries /
add-ins are installed.

Thanks in advance,
Tom
 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmVuIE1jQmVu?=
Guest
Posts: n/a
 
      29th May 2007
Not sure if this is the issue - but where is bVisible defined?

"Tom" wrote:

> Hi all,
> I have a workbook with a fair amount of code written into it. I emailed
> myself a copy of the workbook home on the weekend to work on it and kept
> getting an error with one of the macros at home. I am (was) using the SAME
> version of Excel - 2002 SP3 until I got completely frustrated and dropped the
> $$$ for 2007 for my PC at home. Same problem.
> The part of the code that is hanging is:
> Private Sub Worksheet_Change(ByVal Target As Range)
> Dim sh As Worksheet, sh1 As Worksheet
> Dim rng As Range, Cell As Range
> Set rng = Worksheets("Main").Range("C8:C17")
> If Not Intersect(Target, rng) Is Nothing Then
> For Each sh1 In Worksheets
> ERROR ---> bVisible = False
> If LCase(sh1.Name) <> "main" Then
> For Each Cell In rng
> Set sh = Nothing
> On Error Resume Next
> Set sh = Worksheets(Cell.Value)
> On Error GoTo 0
> If Not sh Is Nothing Then
> If sh.Name = sh1.Name Then
> bVisible = True
> Exit For
> End If
> End If
> Next Cell
> If bVisible Then
> sh1.Visible = xlSheetVisible
> Else
> sh1.Visible = xlSheetHidden
> End If
> End If
> Next sh1
> End If
> End Sub
>
> Any ideas on how to fix this issue? It seems that the same libraries /
> add-ins are installed.
>
> Thanks in advance,
> Tom

 
Reply With Quote
 
paul.robinson@it-tallaght.ie
Guest
Posts: n/a
 
      29th May 2007
Hi
1. Do you mean .Visible = False rather than bVisible = False
2. Aternatively (unlikely though), is bVisible a variable that has not
been declared?!

regards
Paul

On May 29, 10:00 am, Tom <T...@discussions.microsoft.com> wrote:
> Hi all,
> I have a workbook with a fair amount of code written into it. I emailed
> myself a copy of the workbook home on the weekend to work on it and kept
> getting an error with one of the macros at home. I am (was) using the SAME
> version of Excel - 2002 SP3 until I got completely frustrated and dropped the
> $$$ for 2007 for my PC at home. Same problem.
> The part of the code that is hanging is:
> Private Sub Worksheet_Change(ByVal Target As Range)
> Dim sh As Worksheet, sh1 As Worksheet
> Dim rng As Range, Cell As Range
> Set rng = Worksheets("Main").Range("C8:C17")
> If Not Intersect(Target, rng) Is Nothing Then
> For Each sh1 In Worksheets
> ERROR ---> bVisible = False
> If LCase(sh1.Name) <> "main" Then
> For Each Cell In rng
> Set sh = Nothing
> On Error Resume Next
> Set sh = Worksheets(Cell.Value)
> On Error GoTo 0
> If Not sh Is Nothing Then
> If sh.Name = sh1.Name Then
> bVisible = True
> Exit For
> End If
> End If
> Next Cell
> If bVisible Then
> sh1.Visible = xlSheetVisible
> Else
> sh1.Visible = xlSheetHidden
> End If
> End If
> Next sh1
> End If
> End Sub
>
> Any ideas on how to fix this issue? It seems that the same libraries /
> add-ins are installed.
>
> Thanks in advance,
> Tom



 
Reply With Quote
 
paul.robinson@it-tallaght.ie
Guest
Posts: n/a
 
      29th May 2007
Hi
looking further down your code, bVisible is a variable. You need to
put
Dim bVisible as Boolean

at the top of your code. I would guess you have "Option Explicit"
turned on at home but not at work. This means you have to explicitly
declare each variable before you use it (which is good).
regards
Paul

On May 29, 10:15 am, paul.robin...@it-tallaght.ie wrote:
> Hi
> 1. Do you mean .Visible = False rather than bVisible = False
> 2. Aternatively (unlikely though), is bVisible a variable that has not
> been declared?!
>
> regards
> Paul
>
> On May 29, 10:00 am, Tom <T...@discussions.microsoft.com> wrote:
>
>
>
> > Hi all,
> > I have a workbook with a fair amount of code written into it. I emailed
> > myself a copy of the workbook home on the weekend to work on it and kept
> > getting an error with one of the macros at home. I am (was) using the SAME
> > version of Excel - 2002 SP3 until I got completely frustrated and dropped the
> > $$$ for 2007 for my PC at home. Same problem.
> > The part of the code that is hanging is:
> > Private Sub Worksheet_Change(ByVal Target As Range)
> > Dim sh As Worksheet, sh1 As Worksheet
> > Dim rng As Range, Cell As Range
> > Set rng = Worksheets("Main").Range("C8:C17")
> > If Not Intersect(Target, rng) Is Nothing Then
> > For Each sh1 In Worksheets
> > ERROR ---> bVisible = False
> > If LCase(sh1.Name) <> "main" Then
> > For Each Cell In rng
> > Set sh = Nothing
> > On Error Resume Next
> > Set sh = Worksheets(Cell.Value)
> > On Error GoTo 0
> > If Not sh Is Nothing Then
> > If sh.Name = sh1.Name Then
> > bVisible = True
> > Exit For
> > End If
> > End If
> > Next Cell
> > If bVisible Then
> > sh1.Visible = xlSheetVisible
> > Else
> > sh1.Visible = xlSheetHidden
> > End If
> > End If
> > Next sh1
> > End If
> > End Sub

>
> > Any ideas on how to fix this issue? It seems that the same libraries /
> > add-ins are installed.

>
> > Thanks in advance,
> > Tom- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
=?Utf-8?B?VG9t?=
Guest
Posts: n/a
 
      29th May 2007
Hi Paul,
I will add that to the code to see if it makes a difference at home and also
check into see if I have option explicit on/off as well. Thanks for taking a
look at it and for the response.

Tom

"(E-Mail Removed)" wrote:

> Hi
> looking further down your code, bVisible is a variable. You need to
> put
> Dim bVisible as Boolean
>
> at the top of your code. I would guess you have "Option Explicit"
> turned on at home but not at work. This means you have to explicitly
> declare each variable before you use it (which is good).
> regards
> Paul
>
> On May 29, 10:15 am, paul.robin...@it-tallaght.ie wrote:
> > Hi
> > 1. Do you mean .Visible = False rather than bVisible = False
> > 2. Aternatively (unlikely though), is bVisible a variable that has not
> > been declared?!
> >
> > regards
> > Paul
> >
> > On May 29, 10:00 am, Tom <T...@discussions.microsoft.com> wrote:
> >
> >
> >
> > > Hi all,
> > > I have a workbook with a fair amount of code written into it. I emailed
> > > myself a copy of the workbook home on the weekend to work on it and kept
> > > getting an error with one of the macros at home. I am (was) using the SAME
> > > version of Excel - 2002 SP3 until I got completely frustrated and dropped the
> > > $$$ for 2007 for my PC at home. Same problem.
> > > The part of the code that is hanging is:
> > > Private Sub Worksheet_Change(ByVal Target As Range)
> > > Dim sh As Worksheet, sh1 As Worksheet
> > > Dim rng As Range, Cell As Range
> > > Set rng = Worksheets("Main").Range("C8:C17")
> > > If Not Intersect(Target, rng) Is Nothing Then
> > > For Each sh1 In Worksheets
> > > ERROR ---> bVisible = False
> > > If LCase(sh1.Name) <> "main" Then
> > > For Each Cell In rng
> > > Set sh = Nothing
> > > On Error Resume Next
> > > Set sh = Worksheets(Cell.Value)
> > > On Error GoTo 0
> > > If Not sh Is Nothing Then
> > > If sh.Name = sh1.Name Then
> > > bVisible = True
> > > Exit For
> > > End If
> > > End If
> > > Next Cell
> > > If bVisible Then
> > > sh1.Visible = xlSheetVisible
> > > Else
> > > sh1.Visible = xlSheetHidden
> > > End If
> > > End If
> > > Next sh1
> > > End If
> > > End Sub

> >
> > > Any ideas on how to fix this issue? It seems that the same libraries /
> > > add-ins are installed.

> >
> > > Thanks in advance,
> > > Tom- Hide quoted text -

> >
> > - Show quoted text -

>
>
>

 
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
Having an FTP code issue Rico Microsoft Access 4 9th Sep 2009 04:07 PM
code behind issue solutionsdxb@gmail.com Microsoft ASP .NET 4 5th Feb 2008 12:00 PM
Need help with code issue. =?Utf-8?B?Q19Bc2NoZW1hbg==?= Microsoft Access VBA Modules 11 27th Jun 2006 05:39 PM
code issue =?Utf-8?B?ZGNocmlzdG8=?= Microsoft Access Form Coding 8 17th May 2006 08:33 PM
Re: Code Issue Brendan Reynolds Microsoft Access Form Coding 0 7th Sep 2004 05:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:05 PM.