Kelly Kavanagh
asked on
When entering data certain cells cannot be left blank.
I have a spreadsheet that has certain cells that cannot be left blank by the user entering the data.
(I have read similar questions/responses but they are not quite like mine as they are "before save/close" of the spreadsheet".... I need it done before they can go to the next cell)
There are 8 cells throughout the spreadsheet (highlighted in yellow) that need to be entered before the user clicks the "form control button" that is called "ADD RECORD" (this is a macro that takes all the information that was entered in Column B, including the hidden rows and pastes as values into another spreadsheet)
Any help would as always be great! :) BIG thanks
Kelly
(spread sheet attached)
Book1.xlsx
(I have read similar questions/responses but they are not quite like mine as they are "before save/close" of the spreadsheet".... I need it done before they can go to the next cell)
There are 8 cells throughout the spreadsheet (highlighted in yellow) that need to be entered before the user clicks the "form control button" that is called "ADD RECORD" (this is a macro that takes all the information that was entered in Column B, including the hidden rows and pastes as values into another spreadsheet)
Any help would as always be great! :) BIG thanks
Kelly
(spread sheet attached)
Book1.xlsx
I have added sheet event code to remind the user when they enter a yellow cell. The Add Record button does a final check.
Option Explicit
''/// code for button
Sub AddRecord()
Dim rCl As Range
For Each rCl In ActiveSheet.Range("B6:B7,B21:B22,B36:B37,B51:B52")
If IsEmpty(rCl) Then
MsgBox "Please complete all yellow cells", vbCritical, "Input required"
Application.EnableEvents = False
rCl.Select
Application.EnableEvents = True
Exit Sub
End If
Next rCl
''///your code continues here
End Sub
''/// code in sheet event
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
If .Column = 2 And .Interior.ColorIndex = 6 And IsEmpty(Target) Then
MsgBox "This cell must be completed", vbCritical, "Input required"
End If
End With
End Sub
CheckComplete.xlsm
ASKER
I am not very good with looking at script and knowing where it goes....
The attached is what the "Add Record" button does....
I have no idea where I am supposed to put the script that you replied with? HELP!
thanks so much
Kelly
add-record.txt
The attached is what the "Add Record" button does....
I have no idea where I am supposed to put the script that you replied with? HELP!
thanks so much
Kelly
add-record.txt
Why not add the workbook and I'll amend it for you, most of the attached code is unnecessary and will slow down yoor code.
See attached
CheckComplete.xlsm
See attached
CheckComplete.xlsm
ASKER
Hi Roy,
Sounds like a great idea to me! (As I still do not understand...uggg!)
Thanks again:)
Kelly
Sounds like a great idea to me! (As I still do not understand...uggg!)
Thanks again:)
Kelly
ASKER
Attaching my sheet!
Dorst-Data-Collection_KK_r---DO-NOT.xlsm
Dorst-Data-Collection_KK_r---DO-NOT.xlsm
Correct now:)
Dorst-Data-Collection_KK_r---DO-NOT.xlsm
Dorst-Data-Collection_KK_r---DO-NOT.xlsm
ASKER
It doesn't work the same as the example that Roy sent back a few messages ago.... where he asked me to just send him my workbook.
(If you skip the cell it has a pop up right away....) I want that one in my workbook...
thanks,
Kelly
(If you skip the cell it has a pop up right away....) I want that one in my workbook...
thanks,
Kelly
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Awesome!!!! Thank you sooooo much! :):):)
Pleased to help
Please try below code, replace the reference for moving to Sheet2 with your macro of adding records:
Open in new window
Please find attached for your reference.Hope this helps.
AddRecords.xlsm