![]() |
selecting several open worksheets
is there a way to select several open worksheets at a time??
I need to break the links on many worksheets - and do not want to do it sheet by sheet by sheet by sheet, etc. is there a way to open several at a time and get them all into the Edit Links window or is there another way to accomplish the same thing? |
selecting several open worksheets
Check out Bill Manville's FindLinks addin as an easy way to find and remove
all links in a workbook... -- HTH... Jim Thomlinson "Annette" wrote: is there a way to select several open worksheets at a time?? I need to break the links on many worksheets - and do not want to do it sheet by sheet by sheet by sheet, etc. is there a way to open several at a time and get them all into the Edit Links window or is there another way to accomplish the same thing? |
selecting several open worksheets
Ooops... here is the link...
http://www.oaltd.co.uk/MVP/ -- HTH... Jim Thomlinson "Jim Thomlinson" wrote: Check out Bill Manville's FindLinks addin as an easy way to find and remove all links in a workbook... -- HTH... Jim Thomlinson "Annette" wrote: is there a way to select several open worksheets at a time?? I need to break the links on many worksheets - and do not want to do it sheet by sheet by sheet by sheet, etc. is there a way to open several at a time and get them all into the Edit Links window or is there another way to accomplish the same thing? |
selecting several open worksheets
Thank you for the information - I downloaded the addin (and even found
another one I downloaded) - but maybe I just do not know what I am doing because I can still only make changes one sheet at a time, even when I have 5 open. It only changes the active sheet - does anything change a whole book?? "Jim Thomlinson" wrote: Ooops... here is the link... http://www.oaltd.co.uk/MVP/ -- HTH... Jim Thomlinson "Jim Thomlinson" wrote: Check out Bill Manville's FindLinks addin as an easy way to find and remove all links in a workbook... -- HTH... Jim Thomlinson "Annette" wrote: is there a way to select several open worksheets at a time?? I need to break the links on many worksheets - and do not want to do it sheet by sheet by sheet by sheet, etc. is there a way to open several at a time and get them all into the Edit Links window or is there another way to accomplish the same thing? |
selecting several open worksheets
I really <miss-spoke in that last post. What I want to know is :
is there any way to change several (5) workbooks that are in the same file/folder - each workbook only has one sheet and I need to change each sheet in each file/folder (there are over 400 folders) "Annette" wrote: Thank you for the information - I downloaded the addin (and even found another one I downloaded) - but maybe I just do not know what I am doing because I can still only make changes one sheet at a time, even when I have 5 open. It only changes the active sheet - does anything change a whole book?? "Jim Thomlinson" wrote: Ooops... here is the link... http://www.oaltd.co.uk/MVP/ -- HTH... Jim Thomlinson "Jim Thomlinson" wrote: Check out Bill Manville's FindLinks addin as an easy way to find and remove all links in a workbook... -- HTH... Jim Thomlinson "Annette" wrote: is there a way to select several open worksheets at a time?? I need to break the links on many worksheets - and do not want to do it sheet by sheet by sheet by sheet, etc. is there a way to open several at a time and get them all into the Edit Links window or is there another way to accomplish the same thing? |
selecting several open worksheets
Hi Annette
Test this for files in one folder Change MyPath = "C:\Users\Ron\test" If it is working I can change the sub for you so it is working also in every subfolder Sub TestExample() Dim MyPath As String, FilesInPath As String Dim MyFiles() As String, Fnum As Long Dim mybook As Workbook Dim CalcMode As Long Dim sh As Worksheet Dim ErrorYes As Boolean Dim WorkbookLinks As Variant 'Fill in the path\folder where the files are MyPath = "C:\Users\Ron\test" 'Add a slash at the end if the user forget it If Right(MyPath, 1) < "\" Then MyPath = MyPath & "\" End If 'If there are no Excel files in the folder exit the sub FilesInPath = Dir(MyPath & "*.xl*") If FilesInPath = "" Then MsgBox "No files found" Exit Sub End If 'Fill the array(myFiles)with the list of Excel files in the folder Fnum = 0 Do While FilesInPath < "" Fnum = Fnum + 1 ReDim Preserve MyFiles(1 To Fnum) MyFiles(Fnum) = FilesInPath FilesInPath = Dir() Loop 'Change ScreenUpdating, Calculation and EnableEvents With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False .EnableEvents = False End With 'Loop through all files in the array(myFiles) If Fnum 0 Then For Fnum = LBound(MyFiles) To UBound(MyFiles) Set mybook = Nothing On Error Resume Next Set mybook = Workbooks.Open(MyPath & MyFiles(Fnum)) On Error GoTo 0 If Not mybook Is Nothing Then 'Break links in mybook On Error Resume Next With mybook WorkbookLinks = .LinkSources(Type:=xlLinkTypeExcelLinks) If IsArray(WorkbookLinks) Then For i = LBound(WorkbookLinks) To UBound(WorkbookLinks) .BreakLink _ Name:=WorkbookLinks(i), _ Type:=xlLinkTypeExcelLinks Next i Else 'No Links to other workbooks" End If End With If Err.Number 0 Then ErrorYes = True Err.Clear 'Close mybook without saving mybook.Close savechanges:=False Else 'Save and close mybook mybook.Close savechanges:=True End If On Error GoTo 0 Else 'Not possible to open the workbook ErrorYes = True End If Next Fnum End If If ErrorYes = True Then MsgBox "There are problems in one or more files, possible problem:" _ & vbNewLine & "protected workbook/sheet or a sheet/range that not exist" End If 'Restore ScreenUpdating, Calculation and EnableEvents With Application .ScreenUpdating = True .EnableEvents = True .Calculation = CalcMode End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Annette" wrote in message ... I really <miss-spoke in that last post. What I want to know is : is there any way to change several (5) workbooks that are in the same file/folder - each workbook only has one sheet and I need to change each sheet in each file/folder (there are over 400 folders) "Annette" wrote: Thank you for the information - I downloaded the addin (and even found another one I downloaded) - but maybe I just do not know what I am doing because I can still only make changes one sheet at a time, even when I have 5 open. It only changes the active sheet - does anything change a whole book?? "Jim Thomlinson" wrote: Ooops... here is the link... http://www.oaltd.co.uk/MVP/ -- HTH... Jim Thomlinson "Jim Thomlinson" wrote: Check out Bill Manville's FindLinks addin as an easy way to find and remove all links in a workbook... -- HTH... Jim Thomlinson "Annette" wrote: is there a way to select several open worksheets at a time?? I need to break the links on many worksheets - and do not want to do it sheet by sheet by sheet by sheet, etc. is there a way to open several at a time and get them all into the Edit Links window or is there another way to accomplish the same thing? |
selecting several open worksheets
I forgot one Dim line at the top of the macro
Dim I As Long -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Ron de Bruin" wrote in message ... Hi Annette Test this for files in one folder Change MyPath = "C:\Users\Ron\test" If it is working I can change the sub for you so it is working also in every subfolder Sub TestExample() Dim MyPath As String, FilesInPath As String Dim MyFiles() As String, Fnum As Long Dim mybook As Workbook Dim CalcMode As Long Dim sh As Worksheet Dim ErrorYes As Boolean Dim WorkbookLinks As Variant 'Fill in the path\folder where the files are MyPath = "C:\Users\Ron\test" 'Add a slash at the end if the user forget it If Right(MyPath, 1) < "\" Then MyPath = MyPath & "\" End If 'If there are no Excel files in the folder exit the sub FilesInPath = Dir(MyPath & "*.xl*") If FilesInPath = "" Then MsgBox "No files found" Exit Sub End If 'Fill the array(myFiles)with the list of Excel files in the folder Fnum = 0 Do While FilesInPath < "" Fnum = Fnum + 1 ReDim Preserve MyFiles(1 To Fnum) MyFiles(Fnum) = FilesInPath FilesInPath = Dir() Loop 'Change ScreenUpdating, Calculation and EnableEvents With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False .EnableEvents = False End With 'Loop through all files in the array(myFiles) If Fnum 0 Then For Fnum = LBound(MyFiles) To UBound(MyFiles) Set mybook = Nothing On Error Resume Next Set mybook = Workbooks.Open(MyPath & MyFiles(Fnum)) On Error GoTo 0 If Not mybook Is Nothing Then 'Break links in mybook On Error Resume Next With mybook WorkbookLinks = .LinkSources(Type:=xlLinkTypeExcelLinks) If IsArray(WorkbookLinks) Then For i = LBound(WorkbookLinks) To UBound(WorkbookLinks) .BreakLink _ Name:=WorkbookLinks(i), _ Type:=xlLinkTypeExcelLinks Next i Else 'No Links to other workbooks" End If End With If Err.Number 0 Then ErrorYes = True Err.Clear 'Close mybook without saving mybook.Close savechanges:=False Else 'Save and close mybook mybook.Close savechanges:=True End If On Error GoTo 0 Else 'Not possible to open the workbook ErrorYes = True End If Next Fnum End If If ErrorYes = True Then MsgBox "There are problems in one or more files, possible problem:" _ & vbNewLine & "protected workbook/sheet or a sheet/range that not exist" End If 'Restore ScreenUpdating, Calculation and EnableEvents With Application .ScreenUpdating = True .EnableEvents = True .Calculation = CalcMode End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Annette" wrote in message ... I really <miss-spoke in that last post. What I want to know is : is there any way to change several (5) workbooks that are in the same file/folder - each workbook only has one sheet and I need to change each sheet in each file/folder (there are over 400 folders) "Annette" wrote: Thank you for the information - I downloaded the addin (and even found another one I downloaded) - but maybe I just do not know what I am doing because I can still only make changes one sheet at a time, even when I have 5 open. It only changes the active sheet - does anything change a whole book?? "Jim Thomlinson" wrote: Ooops... here is the link... http://www.oaltd.co.uk/MVP/ -- HTH... Jim Thomlinson "Jim Thomlinson" wrote: Check out Bill Manville's FindLinks addin as an easy way to find and remove all links in a workbook... -- HTH... Jim Thomlinson "Annette" wrote: is there a way to select several open worksheets at a time?? I need to break the links on many worksheets - and do not want to do it sheet by sheet by sheet by sheet, etc. is there a way to open several at a time and get them all into the Edit Links window or is there another way to accomplish the same thing? |
selecting several open worksheets
Ron -
WOW - you must be amazing!!! I know what you wrote is probably exactly what I need, but I have no idea how to use it. Please give me some detales on what I should do with all that great code!!!!!!!! Joanne "Ron de Bruin" wrote: I forgot one Dim line at the top of the macro Dim I As Long -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Ron de Bruin" wrote in message ... Hi Annette Test this for files in one folder Change MyPath = "C:\Users\Ron\test" If it is working I can change the sub for you so it is working also in every subfolder Sub TestExample() Dim MyPath As String, FilesInPath As String Dim MyFiles() As String, Fnum As Long Dim mybook As Workbook Dim CalcMode As Long Dim sh As Worksheet Dim ErrorYes As Boolean Dim WorkbookLinks As Variant 'Fill in the path\folder where the files are MyPath = "C:\Users\Ron\test" 'Add a slash at the end if the user forget it If Right(MyPath, 1) < "\" Then MyPath = MyPath & "\" End If 'If there are no Excel files in the folder exit the sub FilesInPath = Dir(MyPath & "*.xl*") If FilesInPath = "" Then MsgBox "No files found" Exit Sub End If 'Fill the array(myFiles)with the list of Excel files in the folder Fnum = 0 Do While FilesInPath < "" Fnum = Fnum + 1 ReDim Preserve MyFiles(1 To Fnum) MyFiles(Fnum) = FilesInPath FilesInPath = Dir() Loop 'Change ScreenUpdating, Calculation and EnableEvents With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False .EnableEvents = False End With 'Loop through all files in the array(myFiles) If Fnum 0 Then For Fnum = LBound(MyFiles) To UBound(MyFiles) Set mybook = Nothing On Error Resume Next Set mybook = Workbooks.Open(MyPath & MyFiles(Fnum)) On Error GoTo 0 If Not mybook Is Nothing Then 'Break links in mybook On Error Resume Next With mybook WorkbookLinks = .LinkSources(Type:=xlLinkTypeExcelLinks) If IsArray(WorkbookLinks) Then For i = LBound(WorkbookLinks) To UBound(WorkbookLinks) .BreakLink _ Name:=WorkbookLinks(i), _ Type:=xlLinkTypeExcelLinks Next i Else 'No Links to other workbooks" End If End With If Err.Number 0 Then ErrorYes = True Err.Clear 'Close mybook without saving mybook.Close savechanges:=False Else 'Save and close mybook mybook.Close savechanges:=True End If On Error GoTo 0 Else 'Not possible to open the workbook ErrorYes = True End If Next Fnum End If If ErrorYes = True Then MsgBox "There are problems in one or more files, possible problem:" _ & vbNewLine & "protected workbook/sheet or a sheet/range that not exist" End If 'Restore ScreenUpdating, Calculation and EnableEvents With Application .ScreenUpdating = True .EnableEvents = True .Calculation = CalcMode End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Annette" wrote in message ... I really <miss-spoke in that last post. What I want to know is : is there any way to change several (5) workbooks that are in the same file/folder - each workbook only has one sheet and I need to change each sheet in each file/folder (there are over 400 folders) "Annette" wrote: Thank you for the information - I downloaded the addin (and even found another one I downloaded) - but maybe I just do not know what I am doing because I can still only make changes one sheet at a time, even when I have 5 open. It only changes the active sheet - does anything change a whole book?? "Jim Thomlinson" wrote: Ooops... here is the link... http://www.oaltd.co.uk/MVP/ -- HTH... Jim Thomlinson "Jim Thomlinson" wrote: Check out Bill Manville's FindLinks addin as an easy way to find and remove all links in a workbook... -- HTH... Jim Thomlinson "Annette" wrote: is there a way to select several open worksheets at a time?? I need to break the links on many worksheets - and do not want to do it sheet by sheet by sheet by sheet, etc. is there a way to open several at a time and get them all into the Edit Links window or is there another way to accomplish the same thing? |
selecting several open worksheets
If you're new to macros:
Debra Dalgleish has some notes how to implement macros he http://www.contextures.com/xlvba01.html David McRitchie has an intro to macros: http://www.mvps.org/dmcritchie/excel/getstarted.htm Ron de Bruin's intro to macros: http://www.rondebruin.nl/code.htm (General, Regular and Standard modules all describe the same thing.) Annette wrote: Ron - WOW - you must be amazing!!! I know what you wrote is probably exactly what I need, but I have no idea how to use it. Please give me some detales on what I should do with all that great code!!!!!!!! Joanne "Ron de Bruin" wrote: I forgot one Dim line at the top of the macro Dim I As Long -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Ron de Bruin" wrote in message ... Hi Annette Test this for files in one folder Change MyPath = "C:\Users\Ron\test" If it is working I can change the sub for you so it is working also in every subfolder Sub TestExample() Dim MyPath As String, FilesInPath As String Dim MyFiles() As String, Fnum As Long Dim mybook As Workbook Dim CalcMode As Long Dim sh As Worksheet Dim ErrorYes As Boolean Dim WorkbookLinks As Variant 'Fill in the path\folder where the files are MyPath = "C:\Users\Ron\test" 'Add a slash at the end if the user forget it If Right(MyPath, 1) < "\" Then MyPath = MyPath & "\" End If 'If there are no Excel files in the folder exit the sub FilesInPath = Dir(MyPath & "*.xl*") If FilesInPath = "" Then MsgBox "No files found" Exit Sub End If 'Fill the array(myFiles)with the list of Excel files in the folder Fnum = 0 Do While FilesInPath < "" Fnum = Fnum + 1 ReDim Preserve MyFiles(1 To Fnum) MyFiles(Fnum) = FilesInPath FilesInPath = Dir() Loop 'Change ScreenUpdating, Calculation and EnableEvents With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False .EnableEvents = False End With 'Loop through all files in the array(myFiles) If Fnum 0 Then For Fnum = LBound(MyFiles) To UBound(MyFiles) Set mybook = Nothing On Error Resume Next Set mybook = Workbooks.Open(MyPath & MyFiles(Fnum)) On Error GoTo 0 If Not mybook Is Nothing Then 'Break links in mybook On Error Resume Next With mybook WorkbookLinks = .LinkSources(Type:=xlLinkTypeExcelLinks) If IsArray(WorkbookLinks) Then For i = LBound(WorkbookLinks) To UBound(WorkbookLinks) .BreakLink _ Name:=WorkbookLinks(i), _ Type:=xlLinkTypeExcelLinks Next i Else 'No Links to other workbooks" End If End With If Err.Number 0 Then ErrorYes = True Err.Clear 'Close mybook without saving mybook.Close savechanges:=False Else 'Save and close mybook mybook.Close savechanges:=True End If On Error GoTo 0 Else 'Not possible to open the workbook ErrorYes = True End If Next Fnum End If If ErrorYes = True Then MsgBox "There are problems in one or more files, possible problem:" _ & vbNewLine & "protected workbook/sheet or a sheet/range that not exist" End If 'Restore ScreenUpdating, Calculation and EnableEvents With Application .ScreenUpdating = True .EnableEvents = True .Calculation = CalcMode End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Annette" wrote in message ... I really <miss-spoke in that last post. What I want to know is : is there any way to change several (5) workbooks that are in the same file/folder - each workbook only has one sheet and I need to change each sheet in each file/folder (there are over 400 folders) "Annette" wrote: Thank you for the information - I downloaded the addin (and even found another one I downloaded) - but maybe I just do not know what I am doing because I can still only make changes one sheet at a time, even when I have 5 open. It only changes the active sheet - does anything change a whole book?? "Jim Thomlinson" wrote: Ooops... here is the link... http://www.oaltd.co.uk/MVP/ -- HTH... Jim Thomlinson "Jim Thomlinson" wrote: Check out Bill Manville's FindLinks addin as an easy way to find and remove all links in a workbook... -- HTH... Jim Thomlinson "Annette" wrote: is there a way to select several open worksheets at a time?? I need to break the links on many worksheets - and do not want to do it sheet by sheet by sheet by sheet, etc. is there a way to open several at a time and get them all into the Edit Links window or is there another way to accomplish the same thing? -- Dave Peterson |
All times are GMT +1. The time now is 03:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com