Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with paste special (values)-looping through the files

Status
Not open for further replies.

abiale

Vendor
Aug 9, 2002
20
PL
Could anybody of you help me solving one problem with the following code (looping through the files). I would like to paste special (values),but VB Editor highlight the following line in yellow :
(ActiveSheet.Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False)

I would be very grateful for your help,

Artur
mail: abiale@sgh.wa.wpl

Here you find the code:


Dim filename As String
filename = Dir("D:\Artur\test\*.xls")
'Start File Search
Do While filename <> &quot;&quot;
' Dim NazwaPliku
Dim PlikWynikowy
PlikWynikowy = &quot;plik wynikowy1.xls&quot;
NazwaPliku = ActiveWindow.Caption

Range(&quot;C4&quot;).Select
Selection.Copy
Windows(PlikWynikowy).Activate
ActiveSheet.Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range(&quot;A1&quot;).Select
Windows(NazwaPliku).Activate
Range(&quot;F4&quot;).Select
Application.CutCopyMode = False
Selection.Copy
Windows(PlikWynikowy).Activate
ActiveSheet.Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range(&quot;A1&quot;).Select
Windows(NazwaPliku).Activate
Range(&quot;F14:J14&quot;).Select
Application.CutCopyMode = False
Selection.Copy
Windows(PlikWynikowy).Activate
ActiveSheet.Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveCell.Offset(1, -2).Range(&quot;A1&quot;).Select
Windows(NazwaPliku).Activate
Range(&quot;A4&quot;).Select
filename = Dir$()
Loop
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top