Hello all,
I wrote a macro to delete existing data on a summary worksheet and replace it with copied data from another worksheet within the same workbook, in order to refresh the summary sheet with updated data each time the workbook. It works well, but for some reason it deletes all items from another worksheet, even though it isn't referenced in the macro. Not only formulas, but any text as well - the only thing it doesn't clear out is formatting.
Anyone know how to fix this? See code below.
Thanks much!
Leif
Sub summary_transfer()
Dim sh1 As Worksheet, sh2 As Worksheet
Dim LstRw As Long
Dim Rng As Range
Dim C As Range
With Worksheets("Summary")
Rows("2:" & Rows.Count).ClearContents
End With
' Keyetta
' exchange "Keyetta" in row below with new sheet name
Set sh1 = Worksheets("Keyetta")
Set sh2 = Worksheets("Summary")
With sh1
LstRw = .Cells(.Rows.Count, "K").End(xlUp).Row
Set Rng = .Range("K1:K" & LstRw)
For Each C In Rng.Cells
If C = "NO" Then
C.EntireRow.Copy sh2.Cells(sh2.Rows.Count, "A").End(xlUp).Offset(1)
End If
Next C
End With
' End Keyetta
End Sub
Bookmarks