我想将表格复制并粘贴到左侧的几列。我的问题是我也使用find函数来查找字符串,所以我不知道表的确切位置,所以我不能使用Range(“A1:C3”)。 这就是我到目前为止所做的:
Columns("M:M").Select
'Types
Set Case1 = Cells.Find(What:="Medium", After:=Range("M7"), LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
Case1.Interior.Color = rgbGreenYellow
Set Case2 = Cells.Find(What:="Light", After:=Range("M7"), LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
Case2.Interior.Color = rgbGreenYellow
Set Result1 = Case1.Offset(4, 0)
Set Result2 = Case2.Offset(4, 0)
If Result1 > Result2 Then
Set Section1 = Case1.Offset(-1, 0)
Set Section2 = Case2.Offset(10, 4)
Set Section = Range("Section1: Section2")
Section.Copy
Range("AC8").Paste
End If
但它不喜欢我的Set Section = Range(“Section1:Section2”) 为了给出一些上下文,我正在比较两个表并复制具有最大值的表