Link to home
Start Free TrialLog in
Avatar of IO_Dork
IO_DorkFlag for United States of America

asked on

Popup alert when row contains data

What vba will continuously look for data entered in to a specific row and then alert user of it automatically without having to run the macro? The alert box should notify the user that they have entered data on Row 1048576 and to clear out the cells.
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

More information is needed.

BTW try the following code. Place the below code on Sheet Module.
To do that, right click the Sheet Tab --> View Code --> Paste the code given below into the opened code window --> Close the VBA Editor --> Save your workbook as Macro-Enabled Workbook.

e.g. The following code will notify the user if the data is entered in rows 10:25 and delete the entry.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Row >= 10 And Target.Row <= 25 Then
   Application.EnableEvents = False
   MsgBox "You have entered the data in Row " & Target.Row & ".", vbExclamation, "Data Not Allowed In This Row!"
   Target.Clear
   Application.EnableEvents = True
   Exit Sub
End If
End Sub

Open in new window

Avatar of IO_Dork

ASKER

basically if someone enters any kind of data in any of the cells in the last Excel row (row 1048576) of a specific worksheet, then I want to alert the user with an alert box that tells them they have "entered information in the last excel row, and to clear that data out".

This is a worksheet that tracks investment transactions. Its a trade blotter, so we are adding new data to each subsequent row on a daily basis, but sometimes the person entering the info has "fat fingers" and ends up accidentally typing trade information into the last row in Excel b/c they hit [Ctlr + arrow down] instead of hitting [tab] to advance to the next column or [Enter] to advance to next empty row.
ASKER CERTIFIED SOLUTION
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of IO_Dork

ASKER

thanks, perfect. even gets rid of the data automatically. thanks.
You're welcome. Glad to help.