Skip to content

Instantly share code, notes, and snippets.

@yatemmma
Created June 29, 2012 11:17
Show Gist options
  • Save yatemmma/3017405 to your computer and use it in GitHub Desktop.
Save yatemmma/3017405 to your computer and use it in GitHub Desktop.
条件付き書式で指定行とdiff
Sub 条件付き書式で指定行とdiff()
Dim rowNum As Integer
rowNum = InputBox("比較対象は何行上?", "", "")
setFormatConditions rowNum
End Sub
Function setFormatConditions(rowNum As Integer)
Selection.FormatConditions.Delete
char = Split(Selection(1).Address, "$")(1)
Dim self, target As String
self = char & Selection(1).Row
target = char & Selection(1).Row - rowNum
frmla = "=" & target & "<>" & self
Selection.FormatConditions.Add Type:=xlExpression, Formula1:=frmla
SelectionFormatConditions(1).Interior.ColorIndex = 26
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment