Excel精英培训网

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

[已解决]关于VBA。find方法的问题请教

[复制链接]
发表于 2017-6-21 11:17 | 显示全部楼层 |阅读模式
find方法请教.rar (7.9 KB, 下载次数: 9)
发表于 2017-6-21 13:59 | 显示全部楼层    本楼为最佳答案   
  1. Sub test()
  2.     With Worksheets(1).Range("a1:i6")
  3.         Set c = .Find([e16].Value, LookIn:=xlValues)
  4.         If Not c Is Nothing Then
  5.             firstAddress = c.Address
  6.             Do
  7.                 s = s & "," & Cells(1, c.Column)
  8.                 Set c = .FindNext(c)
  9.             Loop While Not c Is Nothing And c.Address <> firstAddress
  10.         End If
  11.         ar = Split(Right(s, Len(s) - 1), ",")
  12.         Range("h16").Resize(, UBound(ar) + 1) = ar
  13.     End With
  14. End Sub
复制代码
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-19 10:39 , Processed in 0.405670 second(s), 11 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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