Delete validation input comment in last row column D on Workbook_Close

Ironman

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

I would like to clear the validation input comment in Col D of the last row in Sheet 'Training Log' when the workbook closes and I can't get the code right.

If this can only be done by clearing the validation completely by using Validation.Delete then that's fine, I'd still appreciate that as an alternative.

I don't know if this will make any difference to the code, but the relevant cell does not always contain validation/input comment.

Many thanks!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi Paul
What code are you using ?
 
Upvote 0
Michael

In the Workbook_Close event
VBA Code:
    Worksheets("Training Log").[d].End(xlUp).Row 1
    Validation.InputMessage = Empty
    Validation.InputTitle = Empty

Errored code '424' Object required
 
Upvote 0
Don't have excel so UNTESTED
VBA Code:
lr = Worksheets("Training Log").Cells(Rows.Count, "D").End(xlUp).Row
  With Cells(lr, "D")
   .Validation.InputMessage = Empty
    .Validation.InputTitle = Empty
    End With
 
Upvote 0
Brilliant, that works perfectly, thanks a lot Michael!
 
Upvote 0
I think the code I provided will error if there is no DV in the cell. Try
VBA Code:
lr = Worksheets("Training Log").Cells(Rows.Count, "D").End(xlUp).Row
  With Worksheets("Training Log").Cells(lr, "D")
  On Error Resume Next
   .Validation.InputMessage = Empty
    .Validation.InputTitle = Empty
    End With
 
Upvote 0
Solution
That's great, thanks for thinking of that.
 
Upvote 0

Forum statistics

Threads
1,215,336
Messages
6,124,334
Members
449,155
Latest member
ravioli44

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