|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 打开()
Dim myPath$, myFile$, AK As Workbook, i As Integer
Application.ScreenUpdating = False
myPath = "C:\Users\Administrator\Desktop\封装样本\"
myFile = Dir(myPath & "*.xlsx")
Do While myFile <> ""
If myFile <> ThisWorkbook.Name Then
Set AK = Workbooks.Open(myPath & myFile)
End If
n = Sheets("sheet1").Cells(65536, 3).End(xlUp).Row
For i = 1 To n
If Range("C" & i) Like "2018*" Then ActiveSheet.Rows(i & ":" & i).Copy
'缺代码:这里不会写了,下面写了几个都有问题,具体要求如下
Next
'ActiveSheet.Range("a1").Paste
'ThisWorkbook.Worksheets("Sheet4").Range("A1").Paste
'thisworkbooks.Paste
AK.Close True
myFile = Dir
Loop
Application.ScreenUpdating = True
End Sub
上面缺的代码是:要把复制的内容粘贴到thisworkbook.sheet4.range("b2")里面要从B2单元格开始粘贴,因为A2单元格需要录入人名如下,并且首个单元格以复制那一行的文件名命名!大神些帮忙看哈!搞了一天了,没搞出来!
|
|