Vô hiệu marco khi giá trị 1 ô không thỏa mãn (1 người xem)

Liên hệ QC

Người dùng đang xem chủ đề này

hungdiep85

Thành viên thường trực
Tham gia
1/6/09
Bài viết
218
Được thích
23
Giới tính
Nam
Chào các Thầy


Nếu A1=VANG thì chỉ có nút marco vàng được chạy khi ta chọn,còn nút marco đỏ có chọn cũng không chạy và hiện thông báo nếu chọn và ngược lại cho A1=ĐỎ


Cảm ơn các Thầy
 

File đính kèm

Bạn thử với cặp sau

PHP:
Sub Vang()
    If UCase$(Left([A1], 1)) = "V" Then
        Range("B1").Select
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .Color = 65535
        End With
    Else
    
    End If
End Sub
Mã:
[B]Sub Do_()
[/B]    If UCase$(Left([A1], 1)) <> "V" Then
        Range("B1").Select
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .Color = 255
'       [COLOR=#0000ff]     .TintAndShade = 0[/COLOR]  '
'          [COLOR=#0000ff]  .PatternTintAndShade = 0[/COLOR]   '
        End With
    End If
[B]End Sub
[/B]
 
Upvote 0
PHP:
Sub Vang()
    If UCase$(Left([A1], 1)) = "V" Then
        Range("B1").Select
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .Color = 65535
        End With
    Else
    
    End If
End Sub
Mã:
[B]Sub Do_()
[/B]    If UCase$(Left([A1], 1)) <> "V" Then
        Range("B1").Select
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .Color = 255
'       [COLOR=#0000ff]     .TintAndShade = 0[/COLOR]  '
'          [COLOR=#0000ff]  .PatternTintAndShade = 0[/COLOR]   '
        End With
    End If
[B]End Sub
[/B]






Đúng rùi cảm ơn Thầy
 
Upvote 0
Web KT

Bài viết mới nhất

Back
Top Bottom