Setting default cell values on macro inserted row?

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
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Bump,

Can I change something in the Selection validation to chose default value instead of a blank?

Range("D4").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Yes,No,Unknown,Researching"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
 
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,158
Members
452,892
Latest member
yadavagiri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top