首页 > 解决方案 > 返回带有地址的单元格值

问题描述

查找功能后我有一个手机地址:

YOLO = Worksheets("Adobe Reader").Range("A1:A500").Find("YOLO").Address 'Exemple : $A$131

当我尝试显示地址范围的值时,它只显示地址:

Worksheets("Caracteristiques").Range("B1").Value = Worksheets("Adobe Reader").Range("YOLO").Value

在 B1 范围内,我有 131 美元。我怎样才能得到单元格值呢?

标签: excelvbaexcel-2016

解决方案


How about doing it slightly differently like below:

Dim YOLO As Range
Set YOLO = Worksheets("Adobe Reader").Range("A1:A500").Find(What:="YOLO" LookAt:=xlPart) 
'or LookAt:=xlWhole if the full content of the cell
If Not YOLO is Nothing Then Worksheets("Caracteristiques").Range("B1").Value = YOLO.Value 
'or to get the address (YOLO.Address)

推荐阅读