I have some code where I'm evaluating the value of the last cell in column CB. If that value <> "Current", then that row is copied and pasted into the row below it. I had code that works fine for that, but it was only performing on one row at a time. I did some googling and it seems as though Do Until and Loop would be the answer. I put this code together based on some examples I found, but the code just continues to run, with no results.
Can someone help identify what I need to change?
Can someone help identify what I need to change?
Code:
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Dim csws7 As Worksheet
Dim csLastRow7 As Long
Set csws7 = ThisWorkbook.Sheets("Financials")
csLastRow7 = csws7.Range("D" & Rows.Count).End(xlUp).Row
'If the last value in column CB doesn't = Current, then copy the last row and paste _
it to the next row. Repeat this process until the last value in column CB = Current.
Do Until csws7.Range("CB" & csLastRow7).Value = "Current"
If Not csws7.Range("CB" & csLastRow7).Value = "Current" Then
csws7.Range("A" & csLastRow7 & ":CB" & csLastRow7).Copy
csws7.Range("A" & csLastRow7 + 1).PasteSpecial
csws7.Range("X" & csLastRow7 + 1).Value = ""
csws7.Range("AH" & csLastRow7 + 1).Value = ""
csws7.Range("AR" & csLastRow7 + 1).Value = ""
csws7.Range("BB" & csLastRow7 + 1).Value = ""
csws7.Range("BL" & csLastRow7 + 1).Value = ""
csws7.Range("BT" & csLastRow7 + 1).Value = 0
csws7.Range("BU" & csLastRow7 + 1).Value = 0
csws7.Range("BV" & csLastRow7 + 1).Value = 0
csws7.Range("BW" & csLastRow7 + 1).Value = 0
csws7.Range("BX" & csLastRow7 + 1).Value = 0
End If
Application.CutCopyMode = False
Loop
Application.ScreenUpdating = True
End Sub