+ Reply to Thread
Results 1 to 8 of 8

Cell to be mandatory fill in

  1. #1
    Registered User
    Join Date
    06-27-2005
    Posts
    55

    Question Cell to be mandatory fill in

    I am trying to make a form and I want some cells to be a mandatory fill in.
    If there is something in column C then I would like certain cells in that row to highlight and/or they can't go to the next field until it is filled in.

    I am self taught in Excel that in itself is scary, and my reference is 'Excel 2002 Formulas'. Not sure where or what to look under. I remember reading something on this somewhere but now that I need it I can't find it.

  2. #2
    Bernie Deitrick
    Guest

    Re: Cell to be mandatory fill in

    CBrausa,

    Select all the cells that you want to have required to be filled in, and name that range "MustFill".

    Then copy the code below, right-click the sheet tab, select
    "View Code", and paste the code into the window that appears.

    The code will select the cells that aren't filled in, one at a time. You could also use a message
    bax to say "Fill this in..."

    HTH,
    Bernie Deitrick
    MS Excel MVP

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim myCell As Range
    Dim myRange As Range

    On Error GoTo NoRange
    Set myRange = Range("MustFill")
    For Each myCell In Range("MustFill")
    If myCell.Value = "" Then
    Application.EnableEvents = False
    myCell.Select
    Application.EnableEvents = True
    Exit Sub
    End If
    Next myCell
    NoRange:
    Application.EnableEvents = True
    End Sub



    "CBrausa" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I am trying to make a form and I want some cells to be a mandatory fill
    > in.
    > If there is something in column C then I would like certain cells in
    > that row to highlight and/or they can't go to the next field until it
    > is filled in.
    >
    > I am self taught in Excel that in itself is scary, and my reference is
    > 'Excel 2002 Formulas'. Not sure where or what to look under. I
    > remember reading something on this somewhere but now that I need it I
    > can't find it.
    >
    >
    > --
    > CBrausa
    > ------------------------------------------------------------------------
    > CBrausa's Profile: http://www.excelforum.com/member.php...o&userid=24677
    > View this thread: http://www.excelforum.com/showthread...hreadid=520114
    >




  3. #3
    Registered User
    Join Date
    06-27-2005
    Posts
    55

    If

    Can an IF statement be added, ie: if b10 is >0 then the cells have to be filled in? IF b10 is <0 the cells don't have to be filled in?

  4. #4
    Bernie Deitrick
    Guest

    Re: Cell to be mandatory fill in

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim myCell As Range
    Dim myRange As Range

    On Error GoTo NoRange

    If Range("B10").Value <= 0 Then Exit Sub

    Set myRange = Range("MustFill")
    For Each myCell In Range("MustFill")
    If myCell.Value = "" Then
    Application.EnableEvents = False
    myCell.Select
    Application.EnableEvents = True
    Exit Sub
    End If
    Next myCell
    NoRange:
    Application.EnableEvents = True
    End Sub

    "CBrausa" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Can an IF statement be added, ie: if b10 is >0 then the cells have to be
    > filled in? IF b10 is <0 the cells don't have to be filled in?
    >
    >
    > --
    > CBrausa
    > ------------------------------------------------------------------------
    > CBrausa's Profile:
    > http://www.excelforum.com/member.php...o&userid=24677
    > View this thread: http://www.excelforum.com/showthread...hreadid=520114
    >




  5. #5
    Registered User
    Join Date
    06-27-2005
    Posts
    55
    Bernie-
    Thank you so much for your help. It works up to a certain point and then it stops. Does it make a difference if two cells are merged?
    Once all of the mandatory cells are filled in, can they fill in info in the other cells in that row that pertain to them that are not mandatory?
    B10 is merged with B11. This is the cell that if something is in the cell then the mandatory cells have to be filled in.
    It jumps to the header cells that have to be filled in it then jumps over to the first mandatory cell in the row, I enter a number and it won't continue to the next cell. The other cells that are mandatory are in F10/11 merged as are cells H10/11, S10/11. These have to be filled in but the other cells in the row need info only if the buyer deems it necessary. Where do I go from here?
    Last edited by CBrausa; 03-09-2006 at 10:58 AM.

  6. #6
    Bernie Deitrick
    Guest

    Re: Cell to be mandatory fill in

    Try this. Delete your named range, merge the cells that you want to have
    merged, then select your cells for the named range and rename it. If you
    merge the cells AFTER the name was created, then the second cell of each
    merged cell will cause a problem.

    Bernie


    "CBrausa" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Bernie-
    > Thank you so much for your help. It works up to a certain point and
    > then it stops. Does it make a difference if two cells are merged?
    > Once all of the mandatory cells are filled in, can they fill in info in
    > the other cells in that row that pertain to them that are not
    > mandatory?
    > B10 is merged with B11. This is the cell that if something is in the
    > cell then the mandatory cells have to be filled in.
    > It jumps to the header cells that have to be filled in it then jumps
    > over to the first mandatory cell in the row, I enter a number and it
    > won't continue to the next cell. The other cells that are mandatory are
    > in F10/11 merged as are cells H10/11, S10/11. These have to be filled
    > in but the other cells in the row need info only if the buyer deems it
    > necessary. Where do I go from here?
    >
    >
    > --
    > CBrausa
    > ------------------------------------------------------------------------
    > CBrausa's Profile:
    > http://www.excelforum.com/member.php...o&userid=24677
    > View this thread: http://www.excelforum.com/showthread...hreadid=520114
    >




  7. #7
    Registered User
    Join Date
    06-27-2005
    Posts
    55
    they have always been merged. It's not moving to the next mandatory cell.
    can the other cells then be filled in with what ever ifo the buyer wants listed?

  8. #8
    Bernie Deitrick
    Guest

    Re: Cell to be mandatory fill in

    CBrausa,

    Once the mandatory cells have been filled, then the user can move to any other cell and enter any
    information that they want.

    In all of my tests, the code has worked. Send me a copy of your workbook, with the mandatory cells
    highlighted with color, and I will figure out what's going on in your workbook. Reply to me, then
    take out the spaces and change the dot to .

    HTH,
    Bernie
    MS Excel MVP


    "CBrausa" <[email protected]> wrote in message
    news:[email protected]...
    >
    > they have always been merged. It's not moving to the next mandatory
    > cell.
    > can the other cells then be filled in with what ever ifo the buyer
    > wants listed?
    >
    >
    > --
    > CBrausa
    > ------------------------------------------------------------------------
    > CBrausa's Profile: http://www.excelforum.com/member.php...o&userid=24677
    > View this thread: http://www.excelforum.com/showthread...hreadid=520114
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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