使用VBAselect一个包含文本的单元格

如何select其中包含“Part#1”的单元格,然后将该单元格用作参数之一来select单元格范围。 例如:如果“Part#1”在单元格A1中,我想select单元格范围A1:D4。

Sub Part_1_Select 'Seach for Cell somehow' Cell.Activate ActiveCell: D4.Select Selection.Copy Range("B4").Select Selection.Paste End Sub 

这就是我认为它也应该是类似的。

  Range(Cells.Find(What:="Part # 1").Address & ":D4").Select 
 For Each c In Worksheets("Sheet1").Range("A1:D10").Cells If c.Value = "Part # 1" Then Cell.Activate Range(c & ":D4").Select End If Next 

这不是完美的代码,但它可以为您提供一个很好的起点,以达到您想要的位置。