LiSciAnalyst
New Member
- Joined
- May 26, 2011
- Messages
- 3
How do I set the default values on an row I inserted with a macro.
I have a button "A4" that inserts a full blank line into the sheet and then I choose values from some drop downs in columns D + E (values "Yes", "No", Unknown"
I would like to insert a row with "unknown" already chosen instead of having to choose it manually.
Thanks in advance.
Code:
Attribute VB_Name = "Module1"
Sub Add_Registration()
Attribute Add_Registration.VB_Description = "Macro 1"
Attribute Add_Registration.VB_ProcData.VB_Invoke_Func = " \n14"
Range("A4").Select
Selection.EntireRow.Insert
Range("E4").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Yes,No"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Rows("4:4").Select
Selection.Font.Bold = False
Selection.Font.ColorIndex = 1
Selection.Interior.ColorIndex = 2
Range("A4:L4").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=MOD(ROW()-3,1*2)+1<=1"
Selection.FormatConditions(1).Interior.ColorIndex = 34
Range("A4").Select
ActiveCell.FormulaR1C1 = "=IF(RC[5]=0,""New"",IF(RC[5]<(TODAY()-240),""Update/Check"",""Current""))"
End Sub
I have a button "A4" that inserts a full blank line into the sheet and then I choose values from some drop downs in columns D + E (values "Yes", "No", Unknown"
I would like to insert a row with "unknown" already chosen instead of having to choose it manually.
Thanks in advance.
Code:
Attribute VB_Name = "Module1"
Sub Add_Registration()
Attribute Add_Registration.VB_Description = "Macro 1"
Attribute Add_Registration.VB_ProcData.VB_Invoke_Func = " \n14"
Range("A4").Select
Selection.EntireRow.Insert
Range("E4").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Yes,No"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Rows("4:4").Select
Selection.Font.Bold = False
Selection.Font.ColorIndex = 1
Selection.Interior.ColorIndex = 2
Range("A4:L4").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=MOD(ROW()-3,1*2)+1<=1"
Selection.FormatConditions(1).Interior.ColorIndex = 34
Range("A4").Select
ActiveCell.FormulaR1C1 = "=IF(RC[5]=0,""New"",IF(RC[5]<(TODAY()-240),""Update/Check"",""Current""))"
End Sub