LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
LPS LPS is offline
external usenet poster
 
Posts: 108
Default Modifying a Macro - Help Please

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Modifying Macro simplymidori[_2_] Excel Discussion (Misc queries) 3 April 13th 08 04:17 PM
Need help modifying a macro EAHRENS Excel Discussion (Misc queries) 13 March 31st 06 12:22 AM
Help in modifying a filesearch macro! drucey Excel Programming 8 March 24th 06 12:14 PM
Modifying an Old Excel Macro LPS Excel Programming 3 January 9th 06 02:54 PM
Modifying Macro carl Excel Worksheet Functions 3 August 25th 05 08:45 PM


All times are GMT +1. The time now is 10:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"