Fill Specific text for a specific column

前端 未结 1 1396

I am newbie in here in Stackoverflow and in the VBA Field. Actually I need some help with my code.

I have created a VBA(macro) and it seems there is missing with my cod

相关标签:
1条回答
  • 2021-01-27 20:06

    Are you look for something like this:

    Sub exe()
    
        Dim LastRow As Long, i As Long
    
        With ThisWorkbook.Worksheets("Sheet1")
    
            LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    
            For i = 1 To LastRow
    
                If .Range("A" & i).Value = 0.5 Then
                    .Range("B" & i).Value = "FLAT"
                ElseIf .Range("A" & i).Value = 2 Then
                    .Range("B" & i).Value = "PER"
                End If
    
            Next i
    
        End With
    
    End Sub
    
    0 讨论(0)
提交回复
热议问题