Attribute VB_Name = "模块2"
Sub dataprocess()
'
'dataprocessing
'
Dim newcase As Integer
Dim oldcase As Integer
Dim clscase As Integer
Dim yescase As Integer
Dim todcase As Integer
Dim Sht1 As Worksheet
Set Sht1 = Worksheets("today")
Dim Sht2 As Worksheet
Set Sht2 = Worksheets("yesteday")
yescase = 0
Do
yescase = yescase + 1
Loop Until Sht2.Cells(yescase + 2, 1) = ""
todcase = 0
Do
todcase = todcase + 1
Loop Until Sht1.Cells(todcase + 2, 1) = ""
oldcase = 0
i = 2
Do
j = 2
Do
If Sht1.Cells(i, 1) = Sht2.Cells(j, 1) Then
oldcase = oldcase + 1
'dataprocessing
Sht1.Cells(i, 8) = Sht2.Cells(j, 8)
Sht1.Cells(i, 11) = Sht2.Cells(j, 11)
Sht1.Cells(i, 1).Interior.ColorIndex = 39
'end_dataprocessing
Exit Do
End If
j = j + 1
Loop Until Sht2.Cells(j, 1) = ""
i = i + 1
Loop Until Sht1.Cells(i, 1) = ""
newcase = todcase - oldcase
clscase = yescase - oldcase
MsgBox "Dataprocessing Completed" & vbCrLf & _
"colse case num:" & clscase & vbCrLf & _
"old case num:" & oldcase & vbCrLf & _
"new case num:" & newcase
End Sub
本文来源:https://www.wddqw.com/doc/0839f6950a1c59eef8c75fbfc77da26924c5965b.html
正在阅读:
Excel VBA根据Sheet2中的表格数据处理Sheet1中的数据01-01
让我们一起来积累描写春天的词语吧01-01
小区里大妈大叔文案01-01
事业单位工资标准表01-01
云南大学研究生复试通知单01-01
群星政策代码01-01
红楼梦读后感1000字01-01
我学会了珍惜初三作文01-01