Excel精英培训网

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

[已解决]查找问题的请教

[复制链接]
发表于 2011-3-15 11:41 | 显示全部楼层 |阅读模式
查找问题的请教,详见附件,谢谢!

最佳答案
2011-3-15 13:40
  1. Dim c As Range
  2. With Sheets("Sheet1")
  3.     For i = 3 To [b65536].End(3).Row
  4.         Set c = .Range("a1:IV" & .[IV1].End(1).Column).Find(Cells(i, 2), , , , 1)
  5.         If Not c Is Nothing Then
  6.             Cells(i, "E") = .Cells(22, c.Column)
  7.         End If
  8.     Next
  9. End With
复制代码

ymfk.rar

7.34 KB, 下载次数: 50

excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2011-3-15 12:57 | 显示全部楼层
回复

使用道具 举报

 楼主| 发表于 2011-3-15 13:22 | 显示全部楼层
回复

使用道具 举报

发表于 2011-3-15 13:37 | 显示全部楼层
=HLOOKUP(B3,Sheet1!$1:$65536,22,)
公式就很简单,为啥要用代码呢?
回复

使用道具 举报

发表于 2011-3-15 13:40 | 显示全部楼层    本楼为最佳答案   
  1. Dim c As Range
  2. With Sheets("Sheet1")
  3.     For i = 3 To [b65536].End(3).Row
  4.         Set c = .Range("a1:IV" & .[IV1].End(1).Column).Find(Cells(i, 2), , , , 1)
  5.         If Not c Is Nothing Then
  6.             Cells(i, "E") = .Cells(22, c.Column)
  7.         End If
  8.     Next
  9. End With
复制代码
回复

使用道具 举报

发表于 2011-3-15 14:00 | 显示全部楼层
  1. Sub 仿VLOOUP效果1()
  2.     Dim i&, arr As Range, r1 As Range
  3.     Application.ScreenUpdating = False
  4.     column1 = Sheet1.Range("iv1").End(xlToLeft).Column
  5.     Set arr = Sheet1.Range("E1", Sheet1.Cells(1, column1))
  6.     k = 3
  7.     Do While Cells(k, 2) <> ""
  8.         Set r1 = arr.Find(Cells(k, 2), , , xlWhole)
  9.         If Not r1 Is Nothing Then
  10.             n = r1.Column
  11.             Cells(k, 6) = Sheet1.Cells(22, n)
  12.         End If
  13.         k = k + 1
  14.     Loop
  15.     Application.ScreenUpdating = True
  16. End Sub
复制代码
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-18 08:32 , Processed in 0.450597 second(s), 11 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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