If Cell A1 has contains value cell B1 should not be blank

bhinderwala

New Member
Joined
Dec 12, 2015
Messages
18
Hi

I need a help to write a VBA code for my following query.

If Cell A1 has contains value cell B1 should not be blank and user must need to enter the value before triggering other macros.

Thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Will this code in the Worksheet SelectionChange event work for you?

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address(0, 0) = "A1" Then Exit Sub
If Range("A1") <> "" Then
    If Range("B1") = "" Then
        Application.EnableEvents = False
        Range("B1").Select
        Application.EnableEvents = True
    End If
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,621
Messages
6,125,884
Members
449,268
Latest member
sGraham24

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