I'm really new to VBA. I'm trying to cycle through a worksheet and if the cell has a "0" then I want it to paste "UNK". Any help would be appreciated.
Thanks,
Thanks,
Code:
Public Sub change()
Dim totalRow As Long
'totalRow = Sheet1.Range(Rows.count).End(xlUp).Row
totalRow = 10000
Dim startRow As Integer
startRow = 4
Dim i As Integer
Dim UNK As String
UNK = "UNK"
i = 4
Do Until i = totalRow
If (Sheet1.Cells(startRow, 5)) = "0" Then Sheet1.Cells(startRow, 5).Paste (UNK)
If (Sheet1.Cells(startRow, 6)) = "0" Then Sheet1.Cells(startRow, 6).Paste (UNK)
If (Sheet1.Cells(startRow, 7)) = "0" Then Sheet1.Cells(startRow, 7).Paste (UNK)
If (Sheet1.Cells(startRow, 8)) = "0" Then Sheet1.Cells(startRow, 8).Paste (UNK)
startRow = startRow + 1
i = i + 1
Loop
End Sub