Thread: Paste Values
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
STEVEB STEVEB is offline
external usenet poster
 
Posts: 1
Default Paste Values


Thanks Tom!

Everything worked great, I appreciate your help!!

One more issue......

Do you have any suggestions on how I can incorporate this code int
another Macro I use? The code you suggested below worked great when
defined the workbook to open (bk=workbooks.Open(MyFile.xls).

Dim bk As Workbook, sh As Worksheet
bk = Workbooks.Open("C:\data\Myfiles.xls")
For Each sh In bk.Worksheets
sh.UsedRange.Formula = sh.UsedRange.Value
Next
bk.Close Savechanges:=True

However,

I use a macro to open files based on ranges. The Macro will open th
file in Cell A1, A2, A3... and update the links automatically. A
example of my code is as follows:


Dim sStr As String

Application.DisplayAlerts = False

sStr = Range("A1").Value
sStr2 = Range("A2").Value
sStr3 = Range("A3").Value
sStr4 = Range("A4").Value
sStr5 = Range("A5").Value
sStr6 = Range("A6").Value

Workbooks.Open sStr, UpdateLinks:=0
Workbooks.Open sStr2, UpdateLinks:=0
Workbooks.Open sStr3, UpdateLinks:=0
Workbooks.Open sStr4, UpdateLinks:=0
Workbooks.Open sStr5, UpdateLinks:=0
Workbooks.Open sStr6, UpdateLinks:=0

Application.DisplayAlerts = False


Is there a way to have these files paste values on all worksheets i
the workbook(i.e. the code you suggested above) by refering to the fil
range(i.e. sStr2, etc.) rather than naming the workbook in the code (b
= Workbooks.Open("C:\data\Myfiles.xls"))?

If you have any questions, please let me know.

Any help would be greatly appreciated!

--
STEVE
-----------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...nfo&userid=187
View this thread: http://www.excelforum.com/showthread.php?threadid=39826