Data validation box popup when select Col A in first empty row, then delete when next cell selected

Ironman

Well-known Member
Joined
Jan 31, 2004
Messages
1,069
Office Version
  1. 365
Platform
  1. Windows
Hi

I've put this code together from other bits and pieces in my workbook but it needs gluing together properly and I'm stuck!

I need the below to run only in sheet 'Training Log' when Col A in first empty row is selected:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal target As Range)
If Range("A23358").End(xlUp).Offset(0, 0).Select then ' select Col A in first empty row
With Application
        .SendKeys "i"
        .Dialogs(xlDialogDataValidation).Show  ' show data validation input box with below msg
    .InputTitle = "Reminder"
    .InputMessage = "For Indoor Bike, key Control+\ now"
End With
End If
End Sub

(I got the validation box but no msg - the Input title/msg errored 438 - Object doesn't support property or method)

Then when another cell is selected I need the validation input message clearing.

Many thanks!
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I think your title and message would go where you set up the datavalidation
 
Upvote 0
Hi Johnny, thanks for replying - sorry, I'm not clear on that?
 
Upvote 0
I'm a little confused here.....
Why not simply have the DV in the cells down the column and select the cell...you don't need any code to do that ??
 
Upvote 0
Fair question - simply because it's irrelevant to retain DV in filled rows.

Thinking about it differently, yes it's more straightforward to do as you suggest, but I would need to erase the DV in Col A of the row above the first empty row (not all cells in Column A as some cells in column A have DV for unrelated notes) when the workbook closes.
 
Upvote 0
"but I would need to erase the DV in Col A of the row above the first empty row"

Why ??

And I would avoid sendKeys wherever possible....they will cause serious issues if the correct sheet is not active !!
 
Upvote 0
Again, because it will no longer be relevant - it's a reminder when I select the cell before data is entered in that row, which will be meaningless (and annoying) after data has been entered.

SendKeys point noted - thanks.
 
Upvote 0
It may not be relevant, but it is also not resource hungry either....unless of course you have the entire 1000000 rows of them !!
 
Upvote 0
I suppose I could just highlight and clear a load of them at a time when I remember, but I'd prefer not to have to do that if I can avoid it.

I'm guessing it's not as resource hungry as conditional formatting then.
 
Upvote 0
I'm guessing it's not as resource hungry as conditional formatting then.
I don't believe so
If you want to use a list of DV data use
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal target As Range)
Dim lr As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
If Intersect(target, Range("A" & lr + 1)) Is Nothing Then Exit Sub ' select Col A in first empty row
ActiveCell.Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Formula1:="YOUR LIST OF STUFF IN HERE"
cells(lr,1).validation.delete
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,225,360
Messages
6,184,508
Members
453,237
Latest member
lordleo

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