data validation input message question

ErinJ

New Member
Joined
May 27, 2011
Messages
26
I am creating a spreadsheet that I need to represent every calendar day of the year.

Example
when A2 is selected it will show an input message of 1/1/2011
when B2 is selected it will show an input message of 1/2/2011
When C2 is selected it will show an input message of 1/3/2011
and so on and so on for the entire year.

I like the way data validation input message looks but instead of going to each cell opening data validation clicking input message and typing in each date, I would like to use a formula or VBA to change the input message.

In my mind I would have A1 through 365 columns reflect the correct date by entering the correct starting date in A:1 then extend and fill accordingly.

Then hide row 1 from being seen.

Then A2 through 365 columns as selected will show the input message but would still allow me to enter data in each cell.

How would you do this? (effectively I am creating a gantt chart to schedule jobs)
Thanks - Erin
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi Erin,

You can try the event code below.

To use the code (always test new code on a copy of your workbook):
1. Right Click on the Sheet's Tab
2. Select View Code
3. Paste the Code below into the code module
4. Close the Visual Basic editor

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub
    With Target.Validation
        .Delete
        .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertInformation
        .IgnoreBlank = True
        .InCellDropdown = False
        .InputTitle = ""
        .InputMessage = Cells(1, Target.Column).Value
        .ShowInput = True
        .ShowError = False
    End With
End Sub

This will add validation to the cells as they are selected instead of adding them all at once to all cells in your data range.
 
Upvote 0
Thank you very much - works great. I reposted cause I was affraid I didn't explain myself clearly. Now that I've asked the question I realize it works for all rows and I want to limit it to a certain amount of rows. Specifically 4-28 any thoughts.
 
Upvote 0
Thank you very much - works great. I reposted cause I was affraid I didn't explain myself clearly. Now that I've asked the question I realize it works for all rows and I want to limit it to a certain amount of rows. Specifically 4-28 any thoughts.

Just add this line....

Rich (BB code):
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub
    If Intersect(Target, Rows("4:28")) Is Nothing Then Exit Sub
    With Target.Validation
        .Delete
        .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertInformation
        .IgnoreBlank = True
        .InCellDropdown = False
        .InputTitle = ""
        .InputMessage = Cells(1, Target.Column).Value
        .ShowInput = True
        .ShowError = False
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,217,366
Messages
6,136,128
Members
449,993
Latest member
Sphere2215

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