Unlock cells in other open workbook

S

Steph

Hi. Is there a way to have excel perform code on the only xls workbook open
OTHER THAN the one with the code?

That sounded really bad. Specifically, I want to email out a small
procedure in a workbook that unlocks a group of cells. I was hoping to
simply instruct the user to close out of all other xls workbooks, then push
a button on the workbook I send. I would normally specifically call the
workbook name, but users may have renamed their template. So, I don't want
activeworkbook, and I don't want thisworkbook, I need "only other workbook
open besides the active wrokbook"! Possible? Thanks!
 
J

Jim Rech

You might try something like this:

Sub a()
Dim WB As Workbook
For Each WB In Workbooks
If WB.Name <> ThisWorkbook.Name Then
If WB.Windows(1).Visible Then ''Don't find a hidden WB like Personal
WB.ActiveSheet.Range("A1").Value = 1
Exit For
End If
End If
Next
End Sub


--
Jim
| Hi. Is there a way to have excel perform code on the only xls workbook
open
| OTHER THAN the one with the code?
|
| That sounded really bad. Specifically, I want to email out a small
| procedure in a workbook that unlocks a group of cells. I was hoping to
| simply instruct the user to close out of all other xls workbooks, then
push
| a button on the workbook I send. I would normally specifically call the
| workbook name, but users may have renamed their template. So, I don't
want
| activeworkbook, and I don't want thisworkbook, I need "only other workbook
| open besides the active wrokbook"! Possible? Thanks!
|
|
 

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