Excel精英培训网

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

电子表格中查找一个关键词后整行全部复制

[复制链接]
发表于 2017-2-4 16:17 | 显示全部楼层 |阅读模式
电子表格中查找一个关键词后,将包含这个关键字的整行全部复制。谢谢

求助.rar

6.21 KB, 下载次数: 8

求助

excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2017-2-4 16:52 | 显示全部楼层
改自帮助中的示例代码
Sub test()
Sheets("自建").Select
Cells.Clear
With Sheets("sheet1").[a:a]
   Set c = .Find("今天", LookIn:=xlValues)
    If Not c Is Nothing Then
        firstAddress = c.Address
        Do
            i = i% + 1
            c.Resize(1, 2).Copy Cells(i, 1)
            Set c = .FindNext(c)
        Loop While Not c Is Nothing And c.Address <> firstAddress
    End If
End With
End Sub
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-29 19:07 , Processed in 0.359792 second(s), 15 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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