删除新 table 行中的背景颜色
Removing background color in a new table row
当我在 table 的底部添加新行时,新行的背景颜色与 table 的前一行相同。我希望新行没有背景颜色。
我所做的研究表明我在下面尝试的方法应该有效。它对我不起作用。
Sub Transition_Queue_to_Other()
Dim QueueSheet As Worksheet
Set QueueSheet = ThisWorkbook.Worksheets("Project Queue")
Dim TableQueue As ListObject
Set TableQueue = QueueSheet.ListObjects("TableQueue")
Dim TransColumn As Range
Set TransColumn = QueueSheet.Range("TableQueue[Transition]")
Dim Trans_Queue_Row As Range
Dim i As Integer
With TransColumn
For i = 1 To .Count
If InStr(1, .Rows(i).Value, "NPD") > 0 Then
Dim NPDSheet As Worksheet
Set NPDSheet = ThisWorkbook.Worksheets("NPD")
Dim TableNPD As ListObject
Set TableNPD = NPDSheet.ListObjects("TableNPD")
Set Trans_Queue_Row = TableQueue.DataBodyRange.Rows(i)
Set Trans_NPD_Row = TableNPD.ListRows.Add.Range
'Everything above here works perfectly. My problem is with the following.
Range(Trans_NPD_Row).Select
Selection.Interior.Color = xlNone
End if
Next i
Trans_NPD_Row
是一个 Range
。不要将其包含在 Range
调用中。另外,不需要 Select
.
Trans_NPD_Row.Interior.Color = xlNone
当我在 table 的底部添加新行时,新行的背景颜色与 table 的前一行相同。我希望新行没有背景颜色。
我所做的研究表明我在下面尝试的方法应该有效。它对我不起作用。
Sub Transition_Queue_to_Other()
Dim QueueSheet As Worksheet
Set QueueSheet = ThisWorkbook.Worksheets("Project Queue")
Dim TableQueue As ListObject
Set TableQueue = QueueSheet.ListObjects("TableQueue")
Dim TransColumn As Range
Set TransColumn = QueueSheet.Range("TableQueue[Transition]")
Dim Trans_Queue_Row As Range
Dim i As Integer
With TransColumn
For i = 1 To .Count
If InStr(1, .Rows(i).Value, "NPD") > 0 Then
Dim NPDSheet As Worksheet
Set NPDSheet = ThisWorkbook.Worksheets("NPD")
Dim TableNPD As ListObject
Set TableNPD = NPDSheet.ListObjects("TableNPD")
Set Trans_Queue_Row = TableQueue.DataBodyRange.Rows(i)
Set Trans_NPD_Row = TableNPD.ListRows.Add.Range
'Everything above here works perfectly. My problem is with the following.
Range(Trans_NPD_Row).Select
Selection.Interior.Color = xlNone
End if
Next i
Trans_NPD_Row
是一个 Range
。不要将其包含在 Range
调用中。另外,不需要 Select
.
Trans_NPD_Row.Interior.Color = xlNone