Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default Have A1 in Top left corner of screen Q

I am trying to have A1 at Top left corner of each sheet when I open a
file. The code below is what I am using although it doesn't see to
work on all sheets. There is other stuff this code does, but I'll post
the full code just in case something is causing not all sheets to goto
A1

Private Sub Workbook_Open()
Application.ScreenUpdating = False
Dim myArray As Variant
Dim arName As String
Dim ws As Worksheet
arName = "MyUsers"
myArray = ThisWorkbook.Names(arName).RefersToRange.Value
With Application
If IsError(.Application.Match(.UserName, myArray, 0)) Then
MsgBox "You are NOT Permitted to access this File " & vbCr & _
"" & vbCr & _
"Please Contact Joe Bloggs at " & vbCr & _
"" & vbCr & _
"ABC Group +00999 1 123456"
Application.DisplayAlerts = False
ThisWorkbook.Close False
Else
For Each ws In Worksheets
ws.Visible = True
Next
Worksheets("DontGo").Visible = False
Worksheets("Masters").Visible = xlVeryHidden

For Each ws In ThisWorkbook.Worksheets
If ws.Visible = xlSheetVisible Then
ws.Select False
End If
Next
Application.Goto Range("A1"), True

Sheets("Sum").Activate

Application.DisplayAlerts = True
End If
End With

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Have A1 in Top left corner of screen Q

try this idea
Sub setcell()
'other stuff

Sheets("sheet2").Visible = xlVeryHidden
On Error Resume Next
For i = 1 To Worksheets.Count
Application.Goto Sheets(i).Range("a1")
Next
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Sean" wrote in message
...
I am trying to have A1 at Top left corner of each sheet when I open a
file. The code below is what I am using although it doesn't see to
work on all sheets. There is other stuff this code does, but I'll post
the full code just in case something is causing not all sheets to goto
A1

Private Sub Workbook_Open()
Application.ScreenUpdating = False
Dim myArray As Variant
Dim arName As String
Dim ws As Worksheet
arName = "MyUsers"
myArray = ThisWorkbook.Names(arName).RefersToRange.Value
With Application
If IsError(.Application.Match(.UserName, myArray, 0)) Then
MsgBox "You are NOT Permitted to access this File " & vbCr & _
"" & vbCr & _
"Please Contact Joe Bloggs at " & vbCr & _
"" & vbCr & _
"ABC Group +00999 1 123456"
Application.DisplayAlerts = False
ThisWorkbook.Close False
Else
For Each ws In Worksheets
ws.Visible = True
Next
Worksheets("DontGo").Visible = False
Worksheets("Masters").Visible = xlVeryHidden

For Each ws In ThisWorkbook.Worksheets
If ws.Visible = xlSheetVisible Then
ws.Select False
End If
Next
Application.Goto Range("A1"), True

Sheets("Sum").Activate

Application.DisplayAlerts = True
End If
End With

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default Have A1 in Top left corner of screen Q

Thanks Don

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
Hyperlinks to show on top left corner of screen Elisabeth Excel Worksheet Functions 4 December 3rd 08 04:42 PM
Set A1 on Top left Corner Q Sean Excel Programming 2 April 19th 07 10:37 AM
Moving Active Cell to Upper Left Hand Corner of Screen RJB Excel Programming 2 March 29th 07 08:18 PM
How to make a cell appear in upper left (top left) corner of works jeff Excel Programming 2 March 6th 07 10:14 PM
Scroll a cell to the top left hand corner of the screen Daveh Excel Discussion (Misc queries) 2 August 30th 06 05:17 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"