how to allow row edit only if 1st column is not empty

davidmyers

Board Regular
Joined
Jan 29, 2017
Messages
88
Office Version
  1. 2016
Platform
  1. Windows
Hi, I have a sheet for users to fill, first column A must be filled, after that they can fill any other columns in the row.
How do I ensure column A is not empty?

Thanks for any help
David
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
We can do that with some automated VBA.
Go to the sheet you want to apply this on, right-click on the sheet tab name at the bottom of the sheet, select "View Code", and paste this code in the resulting VB Editor window:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim cell As Range
    Dim updt As Boolean
    
    updt = False
    
    For Each cell In Target
        If cell.Column > 1 And Cells(cell.Row, 1) = "" Then
            Application.EnableEvents = False
            cell.ClearContents
            updt = True
            Application.EnableEvents = True
        End If
    Next cell
    
    If updt Then MsgBox "You cannot update these cells, column A must be updated in the row first"
    
End Sub
That is all you need to do. It will handle the rest automatically.
 
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