Created
July 17, 2009 02:17
-
-
Save haru01/148824 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub セル結合() | |
Selection.Merge | |
With Selection | |
.HorizontalAlignment = xlGeneral | |
.VerticalAlignment = xlCenter | |
End With | |
End Sub | |
Sub 同値セル結合() | |
Application.DisplayAlerts = False | |
Dim r As Integer '最終行番号 | |
Dim c As Integer '列番号 | |
Dim i As Integer | |
Dim j As Integer | |
r = Selection.Row + Selection.Rows.Count - 1 | |
c = Selection.Column | |
j = Selection.Row | |
For i = Selection.Row + 1 To r | |
If Cells(i, c).Value = Cells(j, c).Value Then | |
Range(Cells(j, c), Cells(i, c)).Merge | |
Else | |
j = i | |
End If | |
Next | |
Application.DisplayAlerts = True | |
End Sub | |
Sub 空白セル結合() | |
Application.DisplayAlerts = False | |
Dim r As Integer '最終行番号 | |
Dim c As Integer '列番号 | |
Dim i As Integer | |
Dim j As Integer | |
r = Selection.Row + Selection.Rows.Count - 1 | |
c = Selection.Column | |
j = Selection.Row | |
For i = Selection.Row + 1 To r | |
If Cells(i, c) = "" Then | |
Range(Cells(j, c), Cells(i, c)).Merge | |
Else | |
j = i | |
End If | |
Next | |
Application.DisplayAlerts = True | |
End Sub | |
Sub 行毎に色を変える() | |
Selection.FormatConditions.Delete | |
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _ | |
"=MOD(ROW(),2)=1" | |
Selection.FormatConditions(1).Interior.ColorIndex = 34 | |
End Sub | |
Sub 行毎に色を変える_逆バージョン() | |
Selection.FormatConditions.Delete | |
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _ | |
"=MOD(ROW(),2)=0" | |
Selection.FormatConditions(1).Interior.ColorIndex = 34 | |
End Sub | |
Sub 条件付書式クリア() | |
Selection.FormatConditions.Delete | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment