Advertisement
Danila_lipatov

If_function_vba

Nov 14th, 2024 (edited)
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub FillFinalRatings()
  2.     Dim ws As Worksheet
  3.     Dim lastRow As Long
  4.     Dim i As Long
  5.  
  6.     Set ws = ThisWorkbook.Sheets("Sheet1")
  7.  
  8.     lastRow = ws.Cells(ws.Rows.Count, "J").End(xlUp).Row
  9.  
  10.     For i = 2 To lastRow
  11.         If ws.Cells(i, "J").Value = "0" Then
  12.             ws.Cells(i, "AB").Value = ws.Cells(i, "O").Value
  13.         Else
  14.             ws.Cells(i, "AB").Value = "D"
  15.         End If
  16.     Next i
  17.  
  18. End Sub
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement