我正在尝试创建一个简单的函数,它将在一定范围内的每个单元格周围添加边框。使用精彩的录音,这会产生大量毫无用处的代码。下面的代码将在这个范围内的每个单元格周围显示一个数据“表格”,我想添加一个边框。在网上我还没有找到一个简单或明确的答案。
非常感谢所有帮助!
Set DT = Sheets("DATA")
endRow = DT.Range("F" & Rows.Count).End(xlUp).Row
result = 3
For I = 2 To endRow
If DT.Cells(I, 6).Value = Range("B1").Value Then
Range("A" & result) = DT.Cells(I, 6).Value
Range("B" & result) = DT.Cells(I, 1).Value
Range("C" & result) = DT.Cells(I, 24).Value
Range("D" & result) = DT.Cells(I, 37).Value
Range("E" & result) = DT.Cells(I, 3).Value
Range("F" & result) = DT.Cells(I, 15).Value
Range("G" & result) = DT.Cells(I, 12).Value
Range("H" & result) = DT.Cells(I, 40).Value
Range("I" & result) = DT.Cells(I, 23).Value
result = result + 1
End If
Next I