Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
You could build an array of names in your code--but even better, you could put
your names in a worksheet. Option Explicit Sub Temp2() Dim myRng as Range dim myCell as range dim wkbk as workbook with worksheets("sheet9999") set myRng = .range("a2",.cells(.rows.count,"A").end(xlup)) end with for each mycell in myrng.cells set wkbk = Workbooks.Open (Filename:=mycell.value, UpdateLinks:=3) wkbk.Close savechanges:=True next mycell Workbooks("UpdateFiles").Close savechanges:=True End Sub Eric wrote: Does anyone have any suggestions on how to solve the problem of having too long coding for Macro? I don't want to split the coding into 2 macro separately. Does anyone have any suggestions? Thanks in advance for any suggestions Eric Coding is shown as below: Sub Temp() Application.DisplayAlerts = False Workbooks.Open Filename:="C:\File1.xls", UpdateLinks:=3 Workbooks("File1.xls").Close savechanges:=True Workbooks.Open Filename:="C:\File2.xls", UpdateLinks:=3 Workbooks("File2.xls").Close savechanges:=True Workbooks.Open Filename:="C:\File3.xls", UpdateLinks:=3 Workbooks("File3.xls").Close savechanges:=True ... Workbooks.Open Filename:="C:\File1000.xls", UpdateLinks:=3 Workbooks("File1000.xls").Close savechanges:=True Workbooks("UpdateFiles").Close savechanges:=True End Sub -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to solve too long coding for Macro ? | Excel Worksheet Functions | |||
coding macro | Excel Discussion (Misc queries) | |||
How to use the if statement for Macro coding? | Excel Worksheet Functions | |||
Hidding Macro names and coding | Excel Discussion (Misc queries) | |||
soft-coding lines in a macro | Excel Discussion (Misc queries) |