아래와 같이 코드를 PERSONAL.xls에 추가하시고
매크로(Alt+F8)에서 단축키를 지정해 주시면 됩니다.
제가 좀 나이가 많은 건지 아직 마우스로 작업하는 것보다 키보드 단축키로 작업하는 것이
타격감이 있어서 좋더라구요 ^^;
Sub AlignCenter()
'
' AlignCenter Macro
'
' 가운데 정렬: Ctrl+m
'
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
End With
End Sub
Sub AlignLeft()
'
' AlignLeft Macro
'
' 왼쪽 정렬: Ctrl+r
'
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
End With
End Sub
Sub AlignRight()
'
' AlignRight Macro
'
' 오른쪽 정렬: Ctrl+t
'
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
End With
End Sub
Sub AllMerge()
'
' AllMerge Macro
'
' 셀 머지: Ctrl+m
' 단축키를 한번더 누르면 해지
'
If IsNull(Selection.MergeCells) Then
Selection.UnMerge
Else
If Selection.MergeCells Then
Selection.UnMerge
Else
Selection.Merge True
End If
End If
End Sub
Sub AllLine()
'
' AllLine Macro
' SONBYONGHWAN?(?) 2007/10/13? ??? ???
'
' 선그리기 : Ctrl+j
'
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
If Selection.Cells.Rows.Count = 1 And Selection.Cells.Columns.Count > 1 Then
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
ElseIf Selection.Cells.Rows.Count > 1 And Selection.Cells.Columns.Count = 1 Then
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
ElseIf Selection.Cells.Rows.Count > 1 And Selection.Cells.Columns.Count > 1 Then
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End If
End Sub
'VBA' 카테고리의 다른 글
셀에서 글자 변경시 특정 셀의 색 배경색 변경 (0) | 2006.01.03 |
---|