Ví dụ em bôi đen vùng nào, em chỉ cần bấm Shapes đã tạo thì vùng đó được định dạng theo Macro đã làm. Thày có cách nào không ạ, hay mình chỉ có thể định dạng vùng đã quy định trước thôi
Chào bạn làm được bạn nhé, cái này sẽ viết function rồi cấu hình function đó và gọi trong sự kiện nút shapes như sau:
Sub TestInputBox()
Dim myRange As Range
Set myRange = Application.InputBox(Prompt:= _
"nhập vào một vùng", _
Title:="Gitiho.com", Type:=8)
If myRange Is Nothing Then
MsgBox myRange
Else
myRange.Select
KEBANG myRange
End If
End Sub
Function KEBANG(rng As Range)
With rng
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
End With
End Function
Cảm ơn anh ạ
Chúc bạn học tốt cùng gitiho