Sub 查找相同点()
工作簿1 = ActiveWorkbook.Name
Sheets("表1").Select
H1 = 2
H2 = Cells(65536, 1).End(xlUp).Row
L1 = 1
L2 = Cells(1, 256).End(xlToLeft).Column
For H = H1 To H2
For L = L1 To L2
If Sheets("表1").Cells(H, L) <>Sheets("表2").Cells(H, L) Then
Sheets("表3").Cells(H, L) = LTrim(Str$(Sheets("表1").Cells(H, L))) + "," + LTrim(Str$(Sheets("表2").Cells(H, L)))
End If
Next
Next
End Sub
假定文件夹为:E:\ABC,单元格为A1,代码如下:wjm = Dir("E:\ABC\*.*")
Do While wjm <>""
If InStr(wjm, [A1]) >0 Then Exit Do
wjm = Dir
Loop
If wjm = "" Then [A1].Interior.ColorIndex = 3‘设置背景色为红色
Sub 读文件()On Error GoTo errh
Dim fNum As Integer, Length1 As Long, w1 As String, Isopen As Boolean
fNum = FreeFile()
Open FullNames For Binary As #fNum
Isopen = True
Length1 = LOF(fNum)
w1 = Space$(Length1)
Seek #fNum, 1
Get #fNum, , w1
MsgBox w1
Close
Readbinary = w1
errh:
If Isopen Then Close
MsgBox Err.Description
End Sub
该代码一次读入文件到变量w1中,由于你没有提供文本文件以及怎样整理后写入EXCEL,其他过程都做不了。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)