PC Review


Reply
Thread Tools Rate Thread

Copy a range of cells to all workbooks in a folder?

 
 
harteorama@googlemail.com
Guest
Posts: n/a
 
      12th Sep 2007
Hi all,

Can anybody please help...

I have +100 workbooks that i need to change a named range in (all in a
folder). Is there a way to amend all of them via vba? the thought of
doing it all manually fills me with dread!


ie. Unhide worksheet 'Data', replace range of cells A1:A5 with A, B,
C, D, E and define/name this range as 'Option' and re-hide the sheet

Any help whatsoever would be greatly appreciated.

many thanks

P :-)

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      12th Sep 2007
Something like this????

Sub changebooks()

MyPath = "c:\temp\"

First = True
Do
If First = True Then
Filename = Dir(MyPath & "*.xls")
First = False
Else
Filename = Dir()
End If

If Filename <> "" Then

Workbooks.Open MyPath & Filename
'no need to unhide cells
With Sheets("data")
.Range("A1").Value = A
.Range("A2").Value = B
.Range("A3").Value = C
.Range("A4").Value = D
.Range("A5").Value = E
End With
ActiveWorkbook.Names.Add Name:="Option", _
RefersToR1C1:="=DATA!R1C1:R5C1"
Workbooks(Filename).Close

End If
Loop While Filename <> ""

End Sub

"(E-Mail Removed)" wrote:

> Hi all,
>
> Can anybody please help...
>
> I have +100 workbooks that i need to change a named range in (all in a
> folder). Is there a way to amend all of them via vba? the thought of
> doing it all manually fills me with dread!
>
>
> ie. Unhide worksheet 'Data', replace range of cells A1:A5 with A, B,
> C, D, E and define/name this range as 'Option' and re-hide the sheet
>
> Any help whatsoever would be greatly appreciated.
>
> many thanks
>
> P :-)
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy non-contiguous cells from all workbooks in folder dan dungan Microsoft Excel Programming 8 14th Nov 2007 08:04 PM
Copy Range Between Workbooks =?Utf-8?B?QnJpdGUgR2xvYmFsIChBcmljKQ==?= Microsoft Excel Programming 1 22nd May 2007 10:29 PM
Copy & Paste Range from all Worksheets in all Workbooks in a folder feature86@yahoo.com Microsoft Excel Programming 31 24th Apr 2007 07:11 PM
Copy a range in two different workbooks =?Utf-8?B?QmhhdnRvc2g=?= Microsoft Excel Programming 0 16th May 2005 11:18 AM
Copy range between workbooks Bob Phillips Microsoft Excel Programming 2 1st Aug 2003 11:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:19 AM.