Remove part of row based on cell value

Gwill1983

Board Regular
Joined
Oct 24, 2018
Messages
124
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have a spreadsheet whereby I need to keep track of quotation periods from various manufacturers. Some of these manufacturers have different rules to others and as such one standard set up will not work.

My first sheet is set up as below:

Column D = Manufacturer
Column I = Closing Date
Column J-P = Columns for quote extension dates

The second sheet is set up as below:

Column A = Manufacturer
Column B = Validity period
Column C = Quote can be extended? (y/n)

In essence, I would like to only allow columns J-P to be edited by the user if the manufacturer entered in column D allows the quote to be extended.
I don't care if this is to lock the cells, format the cells or hide them altogether.

I have researched as much as I can, but cannot find any way of changing part of a row depending on the value in a cell.

Does anybody have any ideas on how to achieve this?

Chris
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Start by unlocking all the cells in Sheet1 and then protect the sheet. Place this macro in a standard module and run it from there. The macro assumes that the letter "y" will be in column C of Sheet2. Change the sheet names to suit your needs.
Code:
Sub lockRange()
    Application.ScreenUpdating = False
    Sheets("Sheet1").Unprotect
    Dim LastRow As Long, rng As Range, foundRng As Range
    LastRow = Sheets("Sheet2").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For Each rng In Sheets("Sheet2").Range("C2:C" & LastRow)
        If rng = "y" Then
            Set foundRng = Sheets("Sheet1").Range("D:D").Find(rng.Offset(0, -2), LookIn:=xlValues, lookat:=xlWhole)
            If Not foundRng Is Nothing Then
                Sheets("Sheet1").Range("J" & foundRng.Row).Resize(, 7).Locked = True
            End If
        End If
    Next rng
    Application.ScreenUpdating = True
    Sheets("Sheet1").Protect
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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