Allow Free Text field if Condition is met

leonielroux

New Member
Joined
Dec 18, 2023
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Good day,

I have a sheet that have drop down lists in columns H, K and O. However, I want these columns to become free text if the condition of column D = "Add New".

Please help :)
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
The only way I can think of to do that is to use VBA to remove the Data Validation from those cells.
But once it is gone, it is gone and you cannot get it back from that cell, unless you use VBA to rebuild it again, or copy it from some other cell.
 
Upvote 0
Thanks @Joe4 ,

Can you assist with a VBA code for this? It's okay to remove the data validation as I send it to a client and once they complete it, I don't need it. I will keep the original document with me so that I can access the validations again the next month.
 
Upvote 0
If you want the columns H, K, and O to be updated to remove the Data Validation automatically as cell D is manually updated to "Add New", right-click on the sheet tab name at the bottom of our screen, select "View Code", and paste this code into the VB Editor window that pops up:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim rng As Range
    Dim cell As Range
    
'   See if cells in column D updated
    Set rng = Intersect(Columns("D:D"), Target)
    If rng Is Nothing Then Exit Sub
    
'   Loop through updated cells in column D
    For Each cell In rng
'       See if value in column D is "Add New"
        If cell.Value = "Add New" Then
'           Remove Data Validation from columns H, K, and O
            Cells(cell.Row, "H").Validation.Delete
            Cells(cell.Row, "K").Validation.Delete
            Cells(cell.Row, "O").Validation.Delete
        End If
    Next cell

End Sub
This should do what you want automatically as you update column D manually.
 
Upvote 0

Forum statistics

Threads
1,215,422
Messages
6,124,808
Members
449,191
Latest member
rscraig11

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