[英]Excel macro, to copy and paste a cell value based on another cell value?
[英]Write an Excel macro to find and value, copy that value and paste into a Cell
我想寫一個 excel VBA 宏到
我試過各種版本的
Cells.Find("New Member").Activate
ActiveCell.Offset(0, -5).Range("array1").Select
Selection.Copy
Range("????").Select
ActiveSheet.Paste
If aaa = "" Then
MsgBox "nope"
Else
Range("G5").Select
ActiveSheet.Paste
我的vba excel宏技能很新。 謝謝!
你可以在沒有所有選擇/激活的東西的情況下做到這一點。
Dim rngFound As Range
Set rngFound = Range("Array1").Cells.Find("New Member")
If rngFound Is Nothing Then
Range("G5").Value = "Not Found"
Else
rngFound.Offset(,-5).Resize(,5).Copy Range("G5")
End If
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.