我有这段代码:
Sub WaterToGeneral()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Sheets("water").Activate
Set Water4CabinList = Sheets("water").Range("A2:B" & Range("B" & Rows.Count).End(xlUp).Row)
'Water4CabinList.Select
Sheets("GENERAL").Activate
Set TabGeneral = Sheets("GENERAL").Range("L10:AA" & Range("L" & Rows.Count).End(xlUp).Row)
'TabGeneral.Select
For Each cabin In Water4CabinList.Columns(2).Cells
With TabGeneral
Set ici = .Find(cabin, lookat:=xlWhole)
If Not ici Is Nothing Then
ici.Offset(-1, 0) = cabin.Offset(0, -1)
End If
End With
Next cabin
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
我想放置结果:Offset(-1,0)= cabin.Offset(0,-1) 以背景颜色4为例,我尝试了这个,但它不起作用
With TabGeneral
Set ici = .Find(cabin, lookat:=xlWhole)
If Not ici Is Nothing Then
ici.Offset(-1, 0) = cabin.Offset(0, -1)
ici. select
ici.Offset(-1, 0).Interior.ColorIndex = 4
End If