Skip to content

Instantly share code, notes, and snippets.

Created April 10, 2018 15:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
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 ' 正常数据
If Range("A4").Value <> "" Then
dataCount = ActiveSheet.Range(Selection, Selection.End(xlDown)).Count + 2
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