Hi All,
I have looked on similar post but couldn't find the answer to my query
on the below code, instead of deleting the entire row, I want the row to hide. Can anyone help with this?
Thank you in advance
I have looked on similar post but couldn't find the answer to my query
on the below code, instead of deleting the entire row, I want the row to hide. Can anyone help with this?
Thank you in advance
VBA Code:
Sub commandbutton1_click()
Dim x As Integer
Dim y As Integer
Dim i As Integer
Dim shSource As Worksheet
Dim shTarget1 As Worksheet
Dim shTarget2 As Worksheet
Set shSource = ThisWorkbook.Sheets("Phase Bad Debt Schedule Compan")
Set shTarget1 = ThisWorkbook.Sheets("Paid")
If shTarget1.Cells(7, 32).Value = "" Then
x = 5
Else
x = shTarget1.Cells(7, 32).CurrentRegion.Rows.Count + 5
End If
i = 7
Do Until shSource.Cells(i, 32) = ""
If shSource.Cells(i, 32).Value = "Paid" Then
shSource.Rows(i).Copy
shTarget1.Cells(i, 1).PasteSpecial Paste:=xlPasteValues
shSource.Rows(i).Delete
x = x + 1
GoTo Line1
End If
i = i + 1
Line1: Loop
End Sub