Ironman
Well-known Member
- Joined
- Jan 31, 2004
- Messages
- 1,069
- Office Version
- 365
- Platform
- Windows
Hi
The below code (which I didn't write) includes a data validation entry.
Right now, the data validation applies to whichever sheet I run the macro in.
What I'm after is for the data validation code to only run in sheet1.
Many thanks!
The below code (which I didn't write) includes a data validation entry.
Right now, the data validation applies to whichever sheet I run the macro in.
What I'm after is for the data validation code to only run in sheet1.
Code:
Sub Fillcell(Worksheet As Integer, color As Integer, cValue As String)
Application.EnableEvents = False
If Worksheet = 2 Or 14 Then
With Selection
.Font.Name = "Wingdings"
.Font.Size = 12
.Font.ColorIndex = 1
.Value = cValue
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = False
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = "Double click for lifetime mileage total up to this date"
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End With
End If
With Selection.Interior
.ColorIndex = color
.Pattern = xlSolid
End With
Application.EnableEvents = True
End Sub
Many thanks!