Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A few months ago, someone (I apologise as I cannot remember who) very kindly
gave me some terrific help with an Excel Macro. The macro was designed to add a new row, in the same positon, to several workbooks simultaneously. The workbooks getting the new row have their names hard-coded in the macro (see code below). Initially my client did not give me all the details of her situation. What my client really needs is for that macro to add a specific row, not just to the identified workbooks in the macro, but to all workbooks within a specific directory. She has hundreds of workbooks spread throughout about 3 dozen (or more) directories. Can this mcaro (below) be modified to autoamtically add whatever row number to ALL workbooks with the directory? We are using Excel 2000 in a Windows 2000 or XP O/S. Any and all help is hugely appreciated. Cheers - LPS. Existing Macro: Sub AddRows() Dim sPath As String, v As Variant Dim bk As Workbook, i As Long Dim ans As Variant Dim rw As Long ans = Application.InputBox("Enter the row to add", Type:=1) If ans = False Then Exit Sub rw = CLng(ans) sPath = "H:\training\user requests\2007\helen tsang\Macro Test\" v = Array("1424511.xls", "1424611.xls", "1424411.xls", _ "141461.xls", "141451.xls", "141251.xls", _ "tu0336001.xls", "tu033000w.xls") For i = LBound(v) To UBound(v) Set bk = Workbooks.Open(Filename:=sPath & v(i)) bk.Worksheets(1).Rows(rw).Insert Next End Sub -- LPS |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Modifying Macro | Excel Discussion (Misc queries) | |||
Need help modifying a macro | Excel Discussion (Misc queries) | |||
Help in modifying a filesearch macro! | Excel Programming | |||
Modifying an Old Excel Macro | Excel Programming | |||
Modifying Macro | Excel Worksheet Functions |