Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 1834|回复: 4

[已解决]向高手求解答关于搜索,clear,delete

[复制链接]
发表于 2012-6-12 11:21 | 显示全部楼层 |阅读模式
问题在附件中,谢谢!
最佳答案
2012-6-12 11:41
附件跟上,楼主看一下。记得回愎一下吧。觉得好给个最佳吧

test.zip

1.73 KB, 下载次数: 12

excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2012-6-12 11:31 | 显示全部楼层
  1. Sub test()
  2.     Dim i As Long
  3.     Application.ScreenUpdating = False
  4.     For i = 1 To Range("a65536").End(xlUp).Row
  5.         If Cells(i, 1) = "SNN" Then
  6.             Cells(i, 1).Clear
  7.             Cells(i, 2).Delete xlToLeft
  8.             Cells(i, 4).Delete xlToLeft
  9.         End If
  10.     Next
  11.     Application.ScreenUpdating = True
  12. End Sub
复制代码
回复

使用道具 举报

发表于 2012-6-12 11:39 | 显示全部楼层

  1. Sub Macro2()
  2. Dim rg As Range
  3.    For Each rg In Range("A1:A18")
  4.     If rg.Value = "SNN" Then
  5.       rg.ClearContents
  6.       x = rg.Row
  7.       
  8.       Range("B" & x).ClearContents
  9.       Range("E" & x).ClearContents
  10.       Range("B" & x).Value = Range("C" & x).Value
  11.       Range("c" & x).Value = Range("d" & x).Value
  12.       Range("d" & x).ClearContents
  13.     End If
  14.    Next rg
  15.    
  16. End Sub


复制代码


回复

使用道具 举报

发表于 2012-6-12 11:41 | 显示全部楼层    本楼为最佳答案   
附件跟上,楼主看一下。记得回愎一下吧。觉得好给个最佳吧

楼主看一下.rar

6.08 KB, 下载次数: 8

回复

使用道具 举报

发表于 2012-6-14 00:11 | 显示全部楼层
楼主不回话的啊!!!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-10 07:29 , Processed in 0.961402 second(s), 14 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表