+ Reply to Thread
Results 1 to 6 of 6

Require entry to multiple columns based on other column's values for big amount of records

  1. #1
    Registered User
    Join Date
    08-12-2016
    Location
    DC, USA
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    22

    Require entry to multiple columns based on other column's values for big amount of records

    I have a spreadsheet for some schools to enter their student data and there are a few required fields. Column A is for students' first names, column B is for students' last names, column C is for student status (ft vs. pt), column D is for major, and column E is for gender. I want to make sure that if first name and last name are entered in a row, the information of student status, major, and gender will be also be provided. The amount of students in a given school could be up to several hundreds, so I can't really write some codes to require answers for one student record and repeat it several hundred times. Can someone please help me with some codes that require answers for all the student records if first name and last name are entered to a row of the student records?

    Thank you very much!

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Require entry to multiple columns based on other column's values for big amount of rec

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Registered User
    Join Date
    08-12-2016
    Location
    DC, USA
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    22

    Re: Require entry to multiple columns based on other column's values for big amount of rec

    Hopefully I attached it successfully.

    If you go to the "Worksheet for Schs to Fill Out" tab, you will see a worksheet with only column titles in it. This is what I am going to send to schools to fill out. Status (FT or PT), Major, and Gender are required fields. Without requiring mandatory entry in Excel, I could get some data from a school like the one in the "Sample School Response" tab. As highlighted there, some required information is missing. Since I need all the fields to be filled for all the student records, I will need some codes to prevent a school from saving the spreadsheet without all the required cells filled out. What I specifically want is that as long as there is a name in a row (row 2 to row 6 for this sample school), the system will show the message. The desired result is to get some data like the one shown in the "Desired Response" tab. Since a school could have up to a few hundreds of students,I don't want to write some codes for one student record and repeat it for several hundred times. Is there a way to write some codes for all the student records at once?

    Thank you very much!
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-12-2016
    Location
    DC, USA
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    22

    Re: Require entry to multiple columns based on other column's values for big amount of rec

    Hopefully I attached it successfully.

    If you go to the "Worksheet for Schs to Fill Out" tab, you will see a worksheet with only column titles in it. This is what I am going to send to schools to fill out. Status (FT or PT), Major, and Gender are required fields. Without requiring mandatory entry in Excel, I could get some data from a school like the one in the "Sample School Response" tab. As highlighted there, some required information is missing. Since I need all the fields to be filled for all the student records, I will need some codes to prevent a school from saving the spreadsheet without all the required cells filled out. What I specifically want is that as long as there is a name in a row (row 2 to row 6 for this sample school), the system will show the message. The desired result is to get some data like the one shown in the "Desired Response" tab. Since a school could have up to a few hundreds of students,I don't want to write some codes for one student record and repeat it for several hundred times. Is there a way to write some codes for all the student records at once?

    Thank you very much!

  5. #5
    Registered User
    Join Date
    08-12-2016
    Location
    DC, USA
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    22

    Re: Require entry to multiple columns based on other column's values for big amount of rec

    I found some codes and modified them as below, but somehow it didn't work. Anyone knows why? Sample spreadsheet is attached to #3.

    Thank you!

    Option Explicit
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Dim rngCell As Range, strBlanks As String

    Application.ScreenUpdating = False

    strBlanks = vbNullString
    For Each rngCell In Worksheets("Sheet3").Range("A2:A238").Cells
    If Len(Trim(rngCell.Value)) > 0 Then
    If WorksheetFunction.CountA(rngCell.Offset(0, 1).Resize(1, 4)) < 4 Then
    strBlanks = strBlanks & IIf(Len(strBlanks) > 0, ",", "") & _
    Replace(rngCell.Offset(0, 1).Resize(1, 4).SpecialCells(xlCellTypeBlanks).Address, "$", "")
    End If
    End If
    Next

    If Not strBlanks = vbNullString Then
    MsgBox "Entries required in cells " & vbCrLf & vbCrLf & strBlanks
    Cancel = True
    Exit Sub
    End If
    End Sub












    Quote Originally Posted by mikeTRON View Post
    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Last edited by yl41012; 08-14-2016 at 12:01 AM.

  6. #6
    Registered User
    Join Date
    08-12-2016
    Location
    DC, USA
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    22

    Re: Require entry to multiple columns based on other column's values for big amount of rec

    I don't know why, but the codes worked after I tried so many times. I have no idea why.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 11-14-2015, 03:48 PM
  2. Group By the Records based on multiple Column Values
    By Kamalakar M in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-27-2013, 05:18 PM
  3. Require Entry in Cells on Multiple Worksheet
    By Mischief1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-18-2013, 02:11 PM
  4. Replies: 2
    Last Post: 09-14-2012, 12:45 PM
  5. MACRO to transform single column to multiple columns, based in dynamic values
    By gaqueiroz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-08-2012, 01:54 PM
  6. [SOLVED] Require Help - Require Formula for Multiple values in both columns
    By krodge in forum Excel General
    Replies: 6
    Last Post: 01-13-2012, 03:42 AM
  7. [SOLVED] Require Cell Entry based on condition
    By Kathy - Lovullo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-13-2006, 11:10 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1