Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 132
Default open worksheet on first unlocked cell

Hi there

I have a form that opens automatically when the file is open. It has a
combo box with a list of the worksheets that when one is selected the
worksheet opens. I used the following code:

Private Sub ComboBox1_Change()
Sheets(ComboBox1.Text).Select
End Sub

Private Sub UserForm_Activate()
For Each Sheet In ActiveWorkbook.Sheets
ComboBox1.AddItem (Sheet.Name)
Next
End Sub

It works great-- but the active cell is just the last cell used. I want it
to open with the first unlocked cell active. Can this be done, if so, how?
--
Thank-you!
Ruth
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 772
Default open worksheet on first unlocked cell

Before your end sub select the cell
Activesheet.Cells(1,1).select
equalling cells(row,column) so the above selects cell A1
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Ruth" wrote:

Hi there

I have a form that opens automatically when the file is open. It has a
combo box with a list of the worksheets that when one is selected the
worksheet opens. I used the following code:

Private Sub ComboBox1_Change()
Sheets(ComboBox1.Text).Select
End Sub

Private Sub UserForm_Activate()
For Each Sheet In ActiveWorkbook.Sheets
ComboBox1.AddItem (Sheet.Name)
Next
End Sub

It works great-- but the active cell is just the last cell used. I want it
to open with the first unlocked cell active. Can this be done, if so, how?
--
Thank-you!
Ruth

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 772
Default open worksheet on first unlocked cell

you may also use a range
ActiveSheet.Range("K1").Select
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Ruth" wrote:

Hi there

I have a form that opens automatically when the file is open. It has a
combo box with a list of the worksheets that when one is selected the
worksheet opens. I used the following code:

Private Sub ComboBox1_Change()
Sheets(ComboBox1.Text).Select
End Sub

Private Sub UserForm_Activate()
For Each Sheet In ActiveWorkbook.Sheets
ComboBox1.AddItem (Sheet.Name)
Next
End Sub

It works great-- but the active cell is just the last cell used. I want it
to open with the first unlocked cell active. Can this be done, if so, how?
--
Thank-you!
Ruth

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default open worksheet on first unlocked cell

Ruth,

I assume by 'Unlocked' you mean the 'Locked' checkmark has been removed with
Format|Cells - protection tab. If so try this

Private Sub ComboBox1_Change()
For Each c In Sheets(ComboBox1.Text).UsedRange
If c.Locked = False Then
Sheets(ComboBox1.Text).Range(c.Address).Select
Exit For
End If
Next
End Sub

Mike

"Ruth" wrote:

Hi there

I have a form that opens automatically when the file is open. It has a
combo box with a list of the worksheets that when one is selected the
worksheet opens. I used the following code:

Private Sub ComboBox1_Change()
Sheets(ComboBox1.Text).Select
End Sub

Private Sub UserForm_Activate()
For Each Sheet In ActiveWorkbook.Sheets
ComboBox1.AddItem (Sheet.Name)
Next
End Sub

It works great-- but the active cell is just the last cell used. I want it
to open with the first unlocked cell active. Can this be done, if so, how?
--
Thank-you!
Ruth

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 132
Default open worksheet on first unlocked cell

Thank-you! That worked perfectly.
--
Thank-you!
Ruth


"Mike H" wrote:

Ruth,

I assume by 'Unlocked' you mean the 'Locked' checkmark has been removed with
Format|Cells - protection tab. If so try this

Private Sub ComboBox1_Change()
For Each c In Sheets(ComboBox1.Text).UsedRange
If c.Locked = False Then
Sheets(ComboBox1.Text).Range(c.Address).Select
Exit For
End If
Next
End Sub

Mike

"Ruth" wrote:

Hi there

I have a form that opens automatically when the file is open. It has a
combo box with a list of the worksheets that when one is selected the
worksheet opens. I used the following code:

Private Sub ComboBox1_Change()
Sheets(ComboBox1.Text).Select
End Sub

Private Sub UserForm_Activate()
For Each Sheet In ActiveWorkbook.Sheets
ComboBox1.AddItem (Sheet.Name)
Next
End Sub

It works great-- but the active cell is just the last cell used. I want it
to open with the first unlocked cell active. Can this be done, if so, how?
--
Thank-you!
Ruth



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 132
Default open worksheet on first unlocked cell

Thank-you!
--
Thank-you!
Ruth


"John Bundy" wrote:

you may also use a range
ActiveSheet.Range("K1").Select
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Ruth" wrote:

Hi there

I have a form that opens automatically when the file is open. It has a
combo box with a list of the worksheets that when one is selected the
worksheet opens. I used the following code:

Private Sub ComboBox1_Change()
Sheets(ComboBox1.Text).Select
End Sub

Private Sub UserForm_Activate()
For Each Sheet In ActiveWorkbook.Sheets
ComboBox1.AddItem (Sheet.Name)
Next
End Sub

It works great-- but the active cell is just the last cell used. I want it
to open with the first unlocked cell active. Can this be done, if so, how?
--
Thank-you!
Ruth

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
Htperlink in an unlocked cell but protected worksheet ywc Excel Worksheet Functions 0 February 26th 06 12:44 AM
Need to add cell comments in unlocked cell on protected worksheet dan400man Excel Discussion (Misc queries) 3 December 16th 05 08:02 PM
Delete contents of unlocked cells in another worksheet KFEagle Excel Discussion (Misc queries) 3 August 9th 05 08:42 PM
How do you shade in an unlocked cell on a protected worksheet? Questionable Excel Discussion (Misc queries) 1 June 16th 05 11:22 PM
How can I merge unlocked cells in a worksheet that has been protec NeedMergeHelp Excel Discussion (Misc queries) 2 December 7th 04 01:20 AM


All times are GMT +1. The time now is 08:09 AM.

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

About Us

"It's about Microsoft Excel"