yuanlideyu的个人博客分享 http://blog.sciencenet.cn/u/yuanlideyu

博文

VBA 德温特数据WIN版格式AE的筛选

已有 1786 次阅读 2018-6-22 15:56 |个人分类:VBA|系统分类:科研笔记

Sub test()  ' 除去Individual

Dim i, j As Long

For i = 1 To ActiveCell.Row

For j = 1 To 18

If InStr(Cells(i, j), "Individual") > 0 Then

Cells(i, j).ClearContents

End If

Next j

Next i

End Sub



Sub delp()  '去重

Dim i As Long

For i = 1 To 615  '改动行数

   If InStr(Cells(i, 3), "  ") > 0 Then

   Cells(i, 3).Replace "  ", ""

   End If

   If InStr(Cells(i, 5), "  ") > 0 Then

   Cells(i, 5).Replace "  ", ""

   End If

   If (InStr(Cells(i, 2), "-C") And InStr(Cells(i, 4), "-C")) > 0 Then

      If Cells(i, 2) = Cells(i, 4) Then

      Cells(i, 3).ClearContents

      Cells(i, 4).ClearContents

      End If

   ElseIf Cells(i, 1) = Cells(i, 3) Then

      Cells(i, 3).ClearContents

      Cells(i, 4).ClearContents

   End If

  If InStr(Cells(i, 4), "-C") And InStr(Cells(i, 6), "-C") > 0 Then

      If Cells(i, 4) = Cells(i, 6) Then

      Cells(i, 5).ClearContents

     Cells(i, 6).ClearContents

     End If

  ElseIf Cells(i, 3) = Cells(i, 5) Then

     Cells(i, 5).ClearContents

      Cells(i, 6).ClearContents

  End If

   If InStr(Cells(i, 2), "-C") And InStr(Cells(i, 6), "-C") > 0 Then

     If Cells(i, 2) = Cells(i, 6) Then

      Cells(i, 5).ClearContents

     Cells(i, 6).ClearContents

      End If

   ElseIf Cells(i, 1) = Cells(i, 5) Then

      Cells(i, 5).ClearContents

     Cells(i, 6).ClearContents

   End If

   Cells(i, 7) = "check"

Next i

End Sub


Sub clear()  '去掉前面的双空格

[a:a].Replace "  ", ""

End Sub




https://blog.sciencenet.cn/blog-3388383-1120336.html

上一篇:VBA 分类
下一篇:专利类型&德温特数据库
收藏 IP: 168.160.22.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-21 14:45

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部