jeudi 8 octobre 2015

Need to know how to specify the Cell in column M of the active Row

I need to figure out how to tell VBA to go to the cell in column M of the current row and change the number format to 0.00 if the criteria are met. However, the other cells in the current row must stay with 0 number format. Here is the code so far:

Sheets("xxx").Activate
With Sheets("xxx")
    For Lrow = 1 To .UsedRange.Rows.Count
        With .Cells(Lrow, "J")
            If Not IsError(.Value) Then
                If .Value = "Desk to adjust" Then
                    Sheets("xxx").UsedRange.Rows(Lrow).Interior.ColorIndex = 36
                    Sheets("xxx").UsedRange.Rows(Lrow).NumberFormat = "0"
                End If
                If .Value = "Desk to adjust" Then
                    Sheets("xxx").Range("M" & ActiveCell.Row).Select.NumberFormat = "0.00"
                End If
            End If
        End With
    Next
End With

The error I am getting is with this IF:

If .Value = "Desk to adjust" Then
   Sheets("xxx").Range("M" & ActiveCell.Row).Select.NumberFormat = "0.00"
End If

Any Advice here guys?

Aucun commentaire:

Enregistrer un commentaire