+ Reply to Thread
Results 1 to 9 of 9

How to adjust codes to require input to desired cells Only?

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

    How to adjust codes to require input to desired cells Only?

    Hello,

    I am very new to VBA and am hoping that people can please help me.

    I have a spreadsheet that I need schools to fill out, as shown in the attached Excel file. If a student's Status is "Graduated" (column D), I want require them to fill out the "Career After Graduation" column (column G). The closest codes I could come up with are listed below, and I have two problems here.

    1. As shown in the attached image, Excel requires input not only in G2 and G3, but also in other cells. I don't want to require input to other cells, but have no idea how to adjust my codes accordingly.

    2. Also as shown in the attached image, the error message lists the cells that need to be filled out twice. How do I have them only listed once?

    I don't want use data validation since I need to use this function to add some drop-down menu. If you could please help me with the codes, I'd greatly appreciate it!


    Please Login or Register  to view this content.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by jeffreybrown; 08-18-2016 at 07:18 PM. Reason: Added code tags

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: How to adjust codes to require input to desired cells Only?

    Try this code
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

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

    Re: How to adjust codes to require input to desired cells Only?

    @ YasserKhalil

    This worked perfect! Thank you thank you so much!!
    Last edited by jeffreybrown; 08-18-2016 at 07:18 PM. Reason: Removed full quotes

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

    Re: How to adjust codes to require input to desired cells Only?

    @YasserKhlil

    Thank you again for the codes! I now have an additional question.

    I was trying to see if I can apply your codes to different situations. When I changed "Resize(1, 5)) < 5" to different numbers, it worked every time excepted when I changed it to "Resize(1,1)) <1". Instead of giving me a message saying I needed to fill out B2, it says that I need to fill out G2, C2, F2, B3, E3:F3, C4:E4, G4 and G3. Why do you think it let me fill out multiple columns?

    Thank you!
    Attached Images Attached Images
    Last edited by jeffreybrown; 08-18-2016 at 07:17 PM. Reason: Removed full quotes

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: How to adjust codes to require input to desired cells Only?

    If you need to deal with column B only you can change the range ..
    Instead of using A2:A20 .. you can use B2:B20 ..
    So you don't need to offset or resize in this case

    Try the following
    Please Login or Register  to view this content.

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

    Re: How to adjust codes to require input to desired cells Only?

    Thank you!
    Last edited by jeffreybrown; 08-18-2016 at 07:17 PM. Reason: Removed full quotes

  7. #7
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: How to adjust codes to require input to desired cells Only?

    You're welcome. Glad I can offer some help
    Please mark the thread as solved

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: How to adjust codes to require input to desired cells Only?

    Hi yl41012,

    Along with marking your thread as solved, if it is so, please take moment and look at the forum rules about the use of code tags along with not posting full quotes. It just creates clutter.
    HTH
    Regards, Jeff

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

    Re: How to adjust codes to require input to desired cells Only?

    Thank you for letting me know and I am sorry. I didn't realize I should have only quoted part of the code when replying.

+ 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. [SOLVED] Require VBA codes to prepare the summary report from detail data sheet
    By PRADEEPB270 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-21-2013, 11:38 PM
  2. [SOLVED] Require a VBA Code macro to summarize the common material codes and amount from two sheets
    By PRADEEPB270 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-19-2013, 08:12 AM
  3. [SOLVED] Require the VBA codes working to verify and complete the task of multiple conditions
    By PRADEEPB270 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-18-2013, 10:57 AM
  4. Replies: 0
    Last Post: 10-03-2013, 02:02 AM
  5. How to get cells to adjust to input from another cell
    By fionapotter in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 08-08-2013, 12:48 PM
  6. Require input data in certain cells if other cells are filled before saving
    By Jenkins86 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-01-2013, 08:07 PM
  7. Checking if text box input is of desired type
    By Gzdnkh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-08-2012, 06:14 AM
  8. Require some codes for variable in formula
    By Seeking help in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-30-2006, 12:12 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