0
    Dim intCounter As Integer
    Dim j As Integer
    j = Worksheets("Graph Data").Range("C9")

    For intCounter = 0 To j
        If IsEmpty(Worksheets("Graph Data").Cells(9 + intCounter, 5).Value) = "True" Then
        With Worksheets("Graph Data")
        .Range(Cells(9 + intCounter, 3), Cells(9 + intCounter, 11)).Borders(xlEdgeLeft).Weight = xlThick
        .Range(Cells(9 + intCounter, 3), Cells(9 + intCounter, 11)).Borders(xlEdgeBottom).Weight = xlThick
        .Range(Cells(9 + intCounter, 3), Cells(9 + intCounter, 11)).Borders(xlEdgeRight).Weight = xlThick
        .Range(Cells(9 + intCounter, 3), Cells(9 + intCounter, 11)).Borders(xlInsideVertical).Weight = xlThin
        End With
        End If
    Next intCounter

Using the exact same code, but on an ACTIVE worksheet, it works just fine. Trying to reference an inactive worksheet breaks everything. Why? How can I go about avoiding this?

All this is doing is incrementing the border around a table of data in another worksheet when a macro populates data on the current active worksheet. This functionality NEEDS to be a part of the macro that populates data on the current worksheet. It cannot be separated.

Thank you for your time.

P.S.: If you have a way of making all of these borders occur within one line of code, feel free to advise. Thank you.

  • `cells` within the `.range` isn't qualified, add a `.` before the `cells` – Warcupine Sep 08 '22 at 18:34
  • @Warcupine Gosh. Something so simple. What a hero you are. Thank you. I have spent 30 minutes staring at this simple code, wondering why it was failing. Thank you very much. – Commissar Shepard Sep 08 '22 at 18:36

0 Answers0