Created
April 10, 2018 15:54
-
-
Save fuchao2012/1cd626415b9b23bab00211deff5384f3 to your computer and use it in GitHub Desktop.
从固定的表里找到需要的数据粘贴到目标表中
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub getCurrentSheetData() | |
Application.EnableEvents = False | |
Application.ScreenUpdating = False | |
Dim dataCount As Integer, currentSheetName As String | |
If ActiveSheet.Name <> "result" Then | |
currentSheetName = ActiveSheet.Name | |
Application.StatusBar = "处理工作表" & currentSheetName & "中, 老婆大人请稍后..." | |
If ActiveSheet.Range("K1").Value <> "加险" Then ' 正常数据 | |
ActiveSheet.Range("A3").Select | |
If Range("A4").Value <> "" Then | |
dataCount = ActiveSheet.Range(Selection, Selection.End(xlDown)).Count + 2 | |
Else | |
dataCount = 3 | |
End If | |
ActiveSheet.Range(Selection, Range("J" & dataCount)).Select | |
ActiveSheet.Range(Selection, Selection).Copy | |
Worksheets("result").Range("A65535").End(xlUp).Offset(1, 0).AddComment | |
Worksheets("result").Range("A65535").End(xlUp).Offset(1, 0).Comment.Text Text:=currentSheetName | |
Worksheets("result").Range("A65535").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues | |
End If | |
End If | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment