Excel Unlink open excel files

Joined
Dec 15, 2018
Messages
1
Reaction score
0
When an excel file is closed any excel in the task bar opens and I have to close all excel file in the task bar before I get to the file Previously opened. How do I stop excel files from linking in this manner. Some excel files are open all day and only used once or twice but I have to close them multiple times - very annoying.
 
Welcome to the forum! I'm not sure I understand your query... which version of Excel are you using, and which operating system?
 
When an excel file is closed any excel in the task bar opens and I have to close all excel file in the task bar before I get to the file Previously opened. How do I stop excel files from linking in this manner. Some excel files are open all day and only used once or twice but I have to close them multiple times - very annoying.
step 1...
insert a new sheet (to be done only once....not everytime) and give it a unique name

step 2...
right-click on the new sheets name and goto view-code

step 3...
copy-paste the following code there:

step 4...
Double click on Cell A1 of the new sheet.


'code
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)


If Target.Row = 1 And Target.Column = 1 Then
Cells.Clear
Application.GoTo Range("B1")

Totalbooks = Workbooks.Count
If Totalbooks > 1 Then
On Error Resume Next
ActiveWindow.LargeScroll , 16000, , 16000
On Error GoTo 0
Range("B1") = "Following " & Totalbooks & " files are currently open"
x = 1
Do While x <= Totalbooks
ActiveCell.Offset(x, 0) = Workbooks(x).Name
x = x + 1
Loop
Range("B2:B" & Range("B1").End(xlDown).Row).Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("B1").Select
With Selection.Font
.Name = "Brial"
.Size = 18
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Selection.Font.ColorIndex = 9
Columns("B:B").AutoFit
If MsgBox("Ready to Close Extra-Files", vbYesNo) = vbYes Then
Range("B3").Select
Do While ActiveCell <> ""
wb = ActiveCell
Workbooks(wb).Close False
ActiveCell.Offset(1, 0).Select
Loop
End If

Else
Exit Sub
End If

End If
End Sub
 
Back
Top