我下面的代码是检查两个工作表,以查看在特定列中插入的值是否相似。例如,它查看从sheet1 中插入列A中的值是否与 sheet2列B 中插入的值相同。如果是,那么 sheet1列A 中的单元格仍然是白色'否则,他们会变成红色'。代码工作没有任何问题,而且非常快。
我的问题如下。让我们说:
我希望我能以某种方式解释自己。谢谢你的帮助!
class Movies extends Component {
render() {
let movieItems = this.props.movies.map(movie => {
return <MovieItem key={movie.id} movie={movie} />;
});
return <div style={flex}>{movieItems}</div>;
}
}
class Movies extends Component {
render() {
return (
<div style={flex}>
this.props.movies.map((movie)=>{
<MovieItem key={movie.id} movie={movie} />
}
</div>
);
}
}
答案 0 :(得分:1)
喜欢?
Private Sub CommandButton1_Click()
Set wb = Excel.ActiveWorkbook
Set aRec = wb.Worksheets(1)
Set bRec = wb.Worksheets(2)
Application.ScreenUpdating = False
For a = 2 To aRec.Cells(Rows.Count, "A").End(xlUp).Row
Match = Application.Match(aRec.Cells(a, 1).Value, bRec.Columns(2), 0)
If IsError(Match) And Not IsEmpty(aRec.Cells(a, 1)) Then
aRec.Cells(a, 1).Interior.Color = RGB(255, 0, 0)
Else
aRec.Cells(a, 1).Interior.Color = RGB(255, 255, 255)
End If
Next a
End Sub
使用正确的循环变量,Option Explicit,键入声明并重新开启screenupdating on
Option Explicit
Private Sub CommandButton1_Click()
Dim wb As Workbook
Dim aRec As Worksheet
Dim bRec As Worksheet
Dim a As Long
Dim Match As Variant
Set wb = ActiveWorkbook
Set aRec = wb.Worksheets(1)
Set bRec = wb.Worksheets(2)
Application.ScreenUpdating = False
For a = 2 To aRec.Cells(Rows.Count, "A").End(xlUp).Row
Match = Application.Match(aRec.Cells(a, 1).Value, bRec.Columns(2), 0)
If IsError(Match) And Not IsEmpty(aRec.Cells(a, 1)) Then
aRec.Cells(a, 1).Interior.Color = RGB(255, 0, 0)
Else
aRec.Cells(a, 1).Interior.Color = RGB(255, 255, 255)
End If
Next a
Application.ScreenUpdating = True
End Sub