Copy ranges to master table and remove ranges from master table if cell = 0

前端 未结 2 1647
旧时难觅i
旧时难觅i 2021-01-23 16:38

There are 10 Sheets (Sheet1...Sheet10) with tables in the same range (C25:G34 & C42:N51).

The rows have to be copied if the \'Total Weight\' column has valu

2条回答
  •  梦谈多话
    2021-01-23 16:47

    You're getting the error because you have the row and column values swapped around. The row parameter comes first and then comes the column parameter.

    Your code should read as follows:

    If Cells(cRow, cCol).Value = "0" Then
        Range(Cells(rRow, rCol), Cells(cRow, cCol)).ClearContents
    End If
    

    You are trying to clear column 11 from rows 3 to 14 of the "To DNP" worksheet, which obviously contains merged cells.

提交回复
热议问题