ÿþ<HTML> <HEAD> <meta http-equiv="Content-Language" content="cs"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1250"> <title>VBA code</title> </HEAD> </P> <TABLE WIDTH="100%" ALIGN=CENTER CELLSPACING="0" BORDER="0"> <TR> <TD width="27%" align="LEFT" bordercolordark="#000000"><HR><P></TD> <TD ALIGN=CENTER>&nbsp;<P></TD> <TD ALIGN=CENTER>&nbsp;<P></TD> </TR> </TABLE> <style> <!-- a {text-decoration:none} a {color:RED} a {cursor: crosshair;} a:hover {color:WHITE} BODY { SCROLLBAR-FACE-COLOR:"#282828"; SCROLLBAR-HIGHLIGHT-COLOR:"SaddleBrown"; SCROLLBAR-SHADOW-COLOR:"LightSlateGray"; SCROLLBAR-3DLIGHT-COLOR:"LavenderBlush"; SCROLLBAR-ARROW-COLOR:"LightSlateGray"; SCROLLBAR-TRACK-COLOR:"LightSlateGray"; SCROLLBAR-DARKSHADOW-COLOR:"GRAY"; } --> </style> <body leftmargin="0" topmargin="0" marginwidth="0" marginheigt="0" link="BLACK" vlink="BLACK" alink="#C0C0C0" text="LavenderBlush"> <div align="left"> <body bgcolor="#111111"> <TABLE WIDTH="100%" ALIGN=CENTER CELLSPACING="0" BORDER="0"> <TR> <TD ALIGN="LEFT"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></b></p> </TD> <font face="Arial CE, Helvetica CE, Arial, Helvetica, sans-serif"> <TD ALIGN="LEFT"><b> <font color="LavenderBlush" style="font-size: 14pt">Open all files in directory, Copy, CountA, Screenupdating <p align="LEFT"><font color="LavenderBlush" style="font-size: 10pt"> <font face="Arial CE, Helvetica CE, Arial, Helvetica, sans-serif"> Sub Open_My_Files() <BR><BR> &nbsp;&nbsp;&nbsp;&nbsp; Dim MyFile As String<BR> &nbsp;&nbsp;&nbsp;&nbsp; Dim DalsiRadek As Integer <BR><BR> &nbsp;&nbsp;&nbsp;&nbsp; MyPath = "C:\Data\"<BR> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; MyFile = Dir(MyPath) <BR><BR> Application.ScreenUpdating = False <BR><BR> Do While MyFile <> ""<BR> &nbsp;&nbsp;&nbsp;&nbsp; If MyFile Like "*.xls" Then<BR> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Workbooks.Open MyPath & MyFile<BR> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Sheets("result").Select<BR> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Range("B3:AW3").Select<BR> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Selection.Copy <BR><BR> &nbsp;&nbsp;&nbsp;&nbsp; Windows("AnketaKJSS").Activate<BR> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; DalsiRadek = Application.WorksheetFunction.CountA(Range("B:B")) + 5<BR> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Cells(DalsiRadek, 2).Select<BR> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _<BR> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; :=False, Transpose:=False <BR><BR> &nbsp;&nbsp;&nbsp;&nbsp; Workbooks(MyFile).Activate<BR> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; ActiveWorkbook.Close True <BR><BR> &nbsp;&nbsp;&nbsp;&nbsp; End If <BR><BR> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; MyFile = Dir <BR><BR> Loop <BR><BR> Application.ScreenUpdating = True <BR><BR> End Sub <BR><P> </FONT></b></p></TD> <BR><P> </TD> <TD ALIGN="LEFT"><b> <p align="LEFT"><font color="LavenderBlush" style="font-size: 14pt"> </FONT> <p align="LEFT"><font color="LavenderBlush" style="font-size: 10pt"> <BR> <BR><P> <BR><P> <BR><P> <BR><P> </TD> </TR> </TABLE> <p align="RIGHT">Main &nbsp; <a href="http://tf.czu.cz/~ales/vba">+</a>&nbsp; &nbsp; &nbsp; &nbsp; <p align="RIGHT"><font color="SILVER" style="font-size: 8pt"> 2009 &nbsp; &nbsp; </BODY> </HTML>