Cursor Placement

G

Guest

I have a shared workbook which many users on different shifts modify daily.
Two users are complaining that every time they open the workbook, the cursor
defaults to a particular cell, rather then to the last place they worked
before saving and closing. If they do a "Find" before moving the cursor from
that particular cell,
the response is that the information is not found - even though the
information is there on the sheet.
Is there any way to prevent the cursor from reverting to that same cell each
time the workbook opens?
 
G

Guest

You have to save the information before saving the workbook right-click on
the Excel Icon by the File menu and select View Code. The code will go there

On the left drop down box Choose Workbook - this will enter a Workbook_Open
declaration. Leave it for now and move the cursor below the End sub line.

Click the right dropdown button and choose a Before save event. When you
have tweeked the code below you can copy it ignoring the sub and End Sub lines

I added a sheet to a workbook and called it StartUp on the sheet tab

I put this table in
User Name Sheet Cell
Jim Sheet2 $B$11
Fred
Jill

I used this in an ordinary modue to test the code. You would paste the code
between A Workbook_Open sub. Test 1 is Before Save and Test2 is Open

Sub test1()
'workbook before_save event
v = Application.UserName
sh = ActiveSheet.Name
addr = ActiveCell.Address

Application.ScreenUpdating = False
Sheets("StartUp").Select
Select Case v
Case "Jim"
Cells(2, 2) = sh
Cells(2, 3) = addr
Sheets(sh).Select
Range(addr).Select
Case "Fred"
'more code
End Select
Application.ScreenUpdating = True
End Sub


Sub test2()
'workbook_open event
v = Application.UserName
Application.ScreenUpdating = False
Sheets("Startup").Select
Select Case v
Case "Jim"
sh = Cells(2, 2)
addr = Cells(2, 3)
Sheets(sh).Select
Range(addr).Select
Case "Fred"
'more code
End Select
Application.ScreenUpdating = True
End Sub

Hope this helps
Peter
 
G

Guest

I will try that.
Thank you, Billy.
--
"A"


Billy Liddel said:
You have to save the information before saving the workbook right-click on
the Excel Icon by the File menu and select View Code. The code will go there

On the left drop down box Choose Workbook - this will enter a Workbook_Open
declaration. Leave it for now and move the cursor below the End sub line.

Click the right dropdown button and choose a Before save event. When you
have tweeked the code below you can copy it ignoring the sub and End Sub lines

I added a sheet to a workbook and called it StartUp on the sheet tab

I put this table in
User Name Sheet Cell
Jim Sheet2 $B$11
Fred
Jill

I used this in an ordinary modue to test the code. You would paste the code
between A Workbook_Open sub. Test 1 is Before Save and Test2 is Open

Sub test1()
'workbook before_save event
v = Application.UserName
sh = ActiveSheet.Name
addr = ActiveCell.Address

Application.ScreenUpdating = False
Sheets("StartUp").Select
Select Case v
Case "Jim"
Cells(2, 2) = sh
Cells(2, 3) = addr
Sheets(sh).Select
Range(addr).Select
Case "Fred"
'more code
End Select
Application.ScreenUpdating = True
End Sub


Sub test2()
'workbook_open event
v = Application.UserName
Application.ScreenUpdating = False
Sheets("Startup").Select
Select Case v
Case "Jim"
sh = Cells(2, 2)
addr = Cells(2, 3)
Sheets(sh).Select
Range(addr).Select
Case "Fred"
'more code
End Select
Application.ScreenUpdating = True
End Sub

Hope this helps
Peter
 

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