ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unlock cells in other open workbook (https://www.excelbanter.com/excel-programming/344922-unlock-cells-other-open-workbook.html)

Steph[_6_]

Unlock cells in other open workbook
 
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!



Jim Rech

Unlock cells in other open workbook
 
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
"Steph" wrote in message
...
| 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!
|
|




All times are GMT +1. The time now is 11:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com