Cell cannot be blank

SDRBIRD

New Member
Joined
Oct 29, 2009
Messages
2
I need some help sorting out a small issues on a payroll spreadsheet

I need to ensure that all staff have departments. Staff names are entered in range A8:A60 and departments are entered in range B8:B60. I want to be able to stop the user moving away from a cell in range B8:B60 is data is present in adjacent cell in range A8:A60.

any help would be great

Many thanks


 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Try this in the module for the Worksheet:

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Static OldCell As Range
    Application.EnableEvents = False
    If OldCell Is Nothing Then
        Set OldCell = Range("A1")
    End If
    If Not Application.Intersect(OldCell, Range("B8:B60")) Is Nothing Then
        If Not IsEmpty(OldCell.Offset(, -1)) And IsEmpty(OldCell) Then
            OldCell.Select
        Else
            Set OldCell = Target.Cells(1, 1)
        End If
    Else
        Set OldCell = Target.Cells(1, 1)
    End If
    Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,714
Messages
6,174,052
Members
452,542
Latest member
Bricklin

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