ต้องการใส่ค่าในcell แล้วเปลี่ยนสีพื้นหลังในแถวนั้น[VBA]
Posted: Tue Aug 07, 2018 12:35 am
สวัสดีครับ
ผมต้องการใส่ค่าใน column B แล้วให้แถวที่ใส่ค่า เปลี่ยนสีพื้นหลังในช่วง Column A ถึง Column C ครับ
ผมลองเขียนแล้วกลายเป็น สีพื้นหลังเปลี่ยนทั้งหมด
ผมต้องการใส่ค่าใน column B แล้วให้แถวที่ใส่ค่า เปลี่ยนสีพื้นหลังในช่วง Column A ถึง Column C ครับ
ผมลองเขียนแล้วกลายเป็น สีพื้นหลังเปลี่ยนทั้งหมด
Code: Select all
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i As Integer
For i = 2 To 10
If Cells(i, "B").Value = "" Then
Range(Cells(i, "A"), Cells(i, "C")).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.499984740745262
.PatternTintAndShade = 0
End With
End If
Next
End Sub