Hey all,
I'm creating a live document with a number of users and I want to make it as seamless as possible.
The best way I can think to do this is to have a Macro to format a few rows when we have random users creating a new entry.
My problem is I don't know how to skip from Row 1 to Row 3 without reformatting Row 1 and 2.
The Macro Recorder only does the selected cell, so I've manually gone in to change it to activecell, but offset doesn't let me skip lines.
I'm sure the same logic will help me set the conditional formatting in there as well.
Here is What I have so far.. Thanks in advance for any help
Sub New_Safety_Item()
'
' New_Safety_Item Macro
'
' Keyboard Shortcut: Ctrl+q
'
Range(ActiveCell, ActiveCell.Offset(0, 2)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.149998474074526
.PatternTintAndShade = 0
End With
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range(ActiveCell, ActiveCell.Offset(2, 1)).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark2
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
End With
ActiveCell.FormulaR1C1 = "Item #"
ActiveCell.Offset(0, 1).FormulaR1C1 = "Issue"
ActiveCell.Offset(0, 2).FormulaR1C1 = "Status"
ActiveCell.Offset(2, 0).FormulaR1C1 = "Date"
ActiveCell.Offset(2, 1).FormulaR1C1 = "Actions"
ActiveCell.Offset(3, 0).FormulaR1C1 = "On Receipt"
With Selection
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("C2").Select
Selection.FormatConditions.Add Type:=xlTextString, String:="Monitor", _
TextOperator:=xlContains
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 5296274
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Selection.FormatConditions.Add Type:=xlTextString, String:="Closed", _
TextOperator:=xlContains
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Selection.FormatConditions.Add Type:=xlTextString, String:="Open", _
TextOperator:=xlContains
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.599963377788629
End With
Selection.FormatConditions(1).StopIfTrue = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
End Sub
~AZ
I'm creating a live document with a number of users and I want to make it as seamless as possible.
The best way I can think to do this is to have a Macro to format a few rows when we have random users creating a new entry.
My problem is I don't know how to skip from Row 1 to Row 3 without reformatting Row 1 and 2.
The Macro Recorder only does the selected cell, so I've manually gone in to change it to activecell, but offset doesn't let me skip lines.
I'm sure the same logic will help me set the conditional formatting in there as well.
Here is What I have so far.. Thanks in advance for any help
Sub New_Safety_Item()
'
' New_Safety_Item Macro
'
' Keyboard Shortcut: Ctrl+q
'
Range(ActiveCell, ActiveCell.Offset(0, 2)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.149998474074526
.PatternTintAndShade = 0
End With
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range(ActiveCell, ActiveCell.Offset(2, 1)).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark2
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
End With
ActiveCell.FormulaR1C1 = "Item #"
ActiveCell.Offset(0, 1).FormulaR1C1 = "Issue"
ActiveCell.Offset(0, 2).FormulaR1C1 = "Status"
ActiveCell.Offset(2, 0).FormulaR1C1 = "Date"
ActiveCell.Offset(2, 1).FormulaR1C1 = "Actions"
ActiveCell.Offset(3, 0).FormulaR1C1 = "On Receipt"
With Selection
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("C2").Select
Selection.FormatConditions.Add Type:=xlTextString, String:="Monitor", _
TextOperator:=xlContains
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 5296274
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Selection.FormatConditions.Add Type:=xlTextString, String:="Closed", _
TextOperator:=xlContains
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Selection.FormatConditions.Add Type:=xlTextString, String:="Open", _
TextOperator:=xlContains
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.599963377788629
End With
Selection.FormatConditions(1).StopIfTrue = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
End Sub
~AZ