VBA Excel

来源:互联网 发布:阿里云邮电脑客户端 编辑:程序博客网 时间:2024/06/02 14:43
Sub testIsVaildGeo()    Dim shs As Object    Set shs = Sheets(1)    Dim row As Integer    Dim Lng As Integer    Dim Lat As Integer    row = 3    Lng = 4    Lat = 5    Do        With shs.Cells(row, Lat)            If .Value < 0 Or .Value > 90 Then                .Font.Color = RGB(255, 0, 0)            Else                .Font.Color = RGB(0, 0, 0)            End If        End With    row = row + 1    Loop Until IsEmpty(shs.Cells(row, Lat))    row = 3    Do        With shs.Cells(row, Lng)            If .Value < 0 Or .Value > 180 Then                .Font.Color = RGB(255, 0, 0)            Else                .Font.Color = RGB(0, 0, 0)            End If        End With    row = row + 1    Loop Until IsEmpty(shs.Cells(row, Lng))End Sub
原创粉丝点击