Thread: Validation ?
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
steve steve is offline
external usenet poster
 
Posts: 576
Default Validation ?

David,

You could use an "event macro".

Copy and paste the below macro into the module for your entry worksheet.
I have made the assumption that row 1 contains the type of vehicle.
If this is incorrect - you can set hdr = "xxxx"

You could also use the same idea in a standard macro module and
use a loop to add validation to all the cells.

hth...

steve

================================================== ====
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim hdr As String, x As Long
'
hdr = Cells(1, Target.Column)
x = Target.Row
If Len(hdr) 0 Then
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop,
Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = hdr & " " & x & Chr(10) & "Enter Gallons"
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
End Sub
================================================== ======
"David W" wrote in message
...
Got a Question
I have got 12 columns and 160 rows
I need to use an input box in each cell so you will know what cell your

in,
know here's the trick
I know that I can use validation to do this by copying and doing a paste
special, BUT how do you get the contents of the message to grow by one
Example
if A1 had validation and it read
"Truck 1"
"Enter Gallons"
how could you get it to change to
"Truck 2"
"Enter Gallons" in A2 ;and so on
This one is a little tricky for me