+ Reply to Thread
Results 1 to 71 of 71

VBA Data Validation

  1. #1
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    VBA Data Validation

    Hello Guys,

    I have a sheet with calculations built in that require a user to enter data in a specific way other wise it won't calculate correctly. I did post in the General Excel Forum in regards to this and got a couple good responses, but one gave me a better idea which led me to my next question.

    JeteMC suggested using
    Please Login or Register  to view this content.
    Now this is a great start to what I need, but I also wanted to be able to make sure the user is entering a " ' " into the cell as well. With that in mind, is there a way to do this data validation within VBA across a set range of B10:I14 ? I'm trying to idiot proof the form as much as possible to make it easier for users overall.
    Attached Files Attached Files

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    I have not downloaded or looked at your file, but can you explain why you need the apostrophe?
    If use a userform you can use keypress to filter the allowed characters and / or values
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Quote Originally Posted by Keebellah View Post
    I have not downloaded or looked at your file, but can you explain why you need the apostrophe?
    If use a userform you can use keypress to filter the allowed characters and / or values
    Keebellah,

    The apostrophe is needed for the VBA code that does the calculation. It looks for it so it knows that the numbers associated with it are the ft and figures after are the inches and fraction.

    Example: 72' 6 3/8 in cell B10 minus 1' 3 1/8 in cell B11 = 71' 3 1/4 in cell B12.

    What I want the vba validation to do is make sure the user is entering the data into the cells correctly.

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    I added this code

    Please Login or Register  to view this content.
    Check and see
    Attached Files Attached Files

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    I was thinking of a userform, you could take care of all validation there, but I don't know which cells you enter the values in and which are the filled by the calculations.

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    I like these challenged and played around some more.
    I'll stop stalking you after this one
    I included a user input form that will only allow numbers, ', " or /
    It will require some more fine tuning but I hope it helps you along.
    Since I don't know what the real purpose of this file is I use the intersect of the first two rows (8 and 9 ) columns B through I

    Right click mouse to activate the user form
    see attached
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by Keebellah; 09-17-2017 at 04:39 PM. Reason: xtra info

  7. #7
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    I've never done a user form before that actually worked. I've loved the idea of it, but couldn't figure out how to go about doing it. B8:I14 would be the area that requires specific formatting. The user needs to enter the first Number followed by the apostrophe so the VBA code knows thats the FT, and the rest of the numbers are either inches or fractions. I borrowed the Ft and Inches VBA code from Mr. Excel and figured out how to make it work in my form, but I've been tweaking the form further and further as more and more people use it to make it easier. Lately the major problem is people not entering the "Apostrophe" or they are adding "Dashes" making the calculations incorrect.

    I appreciate you taking the time to put some examples together for me. This will help me study what you did and try and learn it so that I can implement it into my project. I have a hard time trying to learn and implement without an example of what I'm trying to do.

    I looked at your code, but I'm not seeing where your telling it that when someone right clicks in a cell between B8:I9 open the user input box? Can you show me the part of the code that does this?

  8. #8
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Hi, check the worksheets VBA, there is Before right click.
    I imagined that that wold at least be known to you since you use it with the Change and Selection Change

    this is the code:
    Please Login or Register  to view this content.
    The red section is the actual userform trigger

  9. #9
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Quote Originally Posted by Keebellah View Post
    Hi, check the worksheets VBA, there is Before right click.
    I imagined that that wold at least be known to you since you use it with the Change and Selection Change

    this is the code:
    Please Login or Register  to view this content.
    The red section is the actual userform trigger
    Keebellah,

    I found the code after I already sent the question. For some reason I had a couple other excel sheets opened at the same time and it wouldn't open your code so I couldn't figure out how you did it.

    Thanks for the help, I'm going to try and use your Userform and see if I can tie the calculation code into that instead of it firing off on a cell change every time. I could then eliminate a couple other trigger events, hopefully cleaning up the code a bit. Any thoughts on doing this is appreciated.

    I do have another question real quick though. It is possible to have the user form make the user enter FT in one box, then inches and fraction in another all in the same userform and still have it populate the cell like you did with the Userform the first time?

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Why not alltogether in one Userform/filed?

  11. #11
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    But you still haven't explained what it all does with Calculation On and Off an so.
    But the userfor, you want to be able to enter ft and inches in one run?

  12. #12
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Quote Originally Posted by Keebellah View Post
    Why not alltogether in one Userform/filed?
    Wait the UserForm can have the calculations built into it? That would be cool....

  13. #13
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Quote Originally Posted by Keebellah View Post
    But you still haven't explained what it all does with Calculation On and Off an so.
    But the userfor, you want to be able to enter ft and inches in one run?
    The form is just a tool for a user to enter values and have the form calculate a final figure for them. Alot of people mess up calculating fractions. So I've been trying to make it easier for users to just enter values and have the form do the math for them, therefore eliminating some user error.

    If the drop down is left to Calculations On, the form will do the calculations for them.
    If left off, the user has to do all the calculations by hand. This is often where alot of user error happen.

    As for "Why not alltogether in one Userform/field" I'm just trying to make it as easy as possible. I figure if someone enters the Ft in one box and the Inches & Fractions into another box, it might make it easier on the user, reducing some errors.

  14. #14
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Yes, But could you explain the idea?
    I honestly do not understand what you're doing, what you're calculating with what.
    I suggest you do that so I can 'see' what you're expecting to happen.
    You got the code from someone and use it but it's a whole lot of double stuff in it an VERY unclear

  15. #15
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Quote Originally Posted by Keebellah View Post
    Yes, But could you explain the idea?
    I honestly do not understand what you're doing, what you're calculating with what.
    I suggest you do that so I can 'see' what you're expecting to happen.
    You got the code from someone and use it but it's a whole lot of double stuff in it an VERY unclear
    Capture.PNG

    If a User leaves the Calculations on.
    Then enters his first value into Section "B"- Open Example: 82' 3 3/8
    Then enters his physical "Ullage" measurement into Section "C" -Open Example: 10' 2 3/8
    Section "D" will calculate automatically. Example Answer: 72' 1 3/8

    If a User flips it, and measures by "Innage". The form would then Calculate Section "B" minus Section "D" and then calculate Section "C"

    Section "E" is another area that takes user input: which then Calculates section "E" minus either Section "C" or "D" depending on the situation. This part is a little tricky only because some times you won't know if something needs to be measured one way or the other. Usually if the user enters an Ullage Value, it would take the Section "C" minus Section "E" and give the difference, but sometimes you need the difference between Section "B" minus Section "E" even though you physically took an Ullage measurement.

    Hopefully that make sense?

  16. #16
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    The user form I posted allows the user to enter 82' 2 1/16" and only those characters are a allowed.
    The user may not enter a ' sign unless a number has been entered and the same for the "etc.
    I'll see if I can figure out the calculation, and yes it could be done per column and also depending o the choice USAGE and the other

  17. #17
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Okay read your explanation which you were typing while I was entering my questions. I'll use that and see if I can put it together for one column at a time.

    PS: Don't reply with quote, it makes for unnecessary large text.
    Last edited by Keebellah; 09-19-2017 at 04:47 PM. Reason: Info

  18. #18
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Capture1.PNG

    I've manage to murder your UserForm.

  19. #19
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    It's bed-time here, more tomorrow.

  20. #20
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    I was working on something similar, just increase height and move the textboxes an both buttons down some

  21. #21
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Quote Originally Posted by Keebellah View Post
    It's bed-time here, more tomorrow.
    Have a good night. Appreciate you taking the time to show me new things. I'll keep plugging away at this so I can trying a familiarize myself with it.

  22. #22
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Please drop the Reply with Quote, just press the Reply button

  23. #23
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    I found this: follow the link : http://lacher.com/examples/lacher18.htm
    Maybe we can integrated it?

  24. #24
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Me again, sorry but let me see if I got it right.
    Which are the user data input Sections?
    AA
    A
    B
    C (either ULLAGE or INNAGE) whatever that stands for)\
    E

    The others D and F are calculated values.

    Is this correct?

    So if the user enters values and changes Calculate Difference to Yes the calculations are done?

    If not he / she may choose to these him/her-self?

  25. #25
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    No answer so my modifications are based on the little information you gave me tow or three posts ago.

    You right click Section B or C or E and enter the data

    All in one textbox only allowed characters are permitted, 0-9, ' " - /

    Enjoy, will requite fine tuning
    Attached Files Attached Files

  26. #26
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Hey sorry, I wasn't getting any notices that you replied to the thread, thought you gave up on me . Let me catch up and I'll answer what I can in 1 response.

  27. #27
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    I don't give up that easily

  28. #28
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Users input data into:

    B8
    B9
    B10
    B11 if Cell A5 isn't switched to INNAGE. Otherwise user enters into B12 but I guess this could be changed though so the input is always in B11. Probably would make more sense.
    B13

    I'm looking at your new one, What is textbox 2 for in the user input form?

  29. #29
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Textbox2 is nothing else than the result of the user input that is used when you press OK, shows the validated input

  30. #30
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Oh ok then. Do we need it?

    Let me play with this and see if I can figure out how to manipulate it myself a bit. I tried resizing the box before, but it didn't seem to work correctly and was wrapping the text or overlapping it. Couldn't figure out what I was doing wrong.

  31. #31
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Ok I'm thinking with the way you have it setup to make the user Right Click to bring up the input box, that I'm going to remove the "Calculate Difference Yes/No" Really no point in having that. If the user right clicks to bring up the box, I'd like to make it calculate once the box closes. If for some reason the user wants to manually input something, they can simple just left click in the box and enter what they want right?

    Am I correct in this thinking? I understand there code looking for cell A4, but with that commented or removed, could this be done?

  32. #32
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Yes we (the code) needs it

    Please Login or Register  to view this content.
    You can hide it (make it hidden Visible=False) but it needs to be present

  33. #33
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Ok thanks. Working through it still. Coming up with more ideas as I go along.

    Thats the problem with learning new things. You come to find the way you were doing things were slow and obsolete Then you get to start all over again.

  34. #34
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Left Click? Box?
    If they want to enter manually just do it in the worksheet
    If Calculations is No then only the entered values are placed but nothing is calculated

  35. #35
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    That's the way I started, only then there were no forums, so it was trial and error, and still is.
    VBA is limited by your imagination and what you need the most is time and a lot of patience

  36. #36
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    By your imagination I mean the person's imagination, not one in particular, you can so much with it, it's fun (at least I see it that way)

  37. #37
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Definitely alot of fun. My problem is that I forget things very easily and takes me a while to learn things to become fluent in them. In general I can pick things up fairly quick to manipulate them, and not fully understand them. This is where I rely on help from guys like you that will take the time to point things out for me so I know what I did wrong or overlooked.

    And to answer one of your questions I missed:

    In relation to what I'm dealing with:
    Innage = measured from the bottom of a liquid to the top of the liquid.
    Ullage = measured from the top of the liquid to a fixed point above the liquid.

    Example:
    Fixed Height of 10ft
    Top of liquid is 8ft = Ullage would be 2ft
    OR an Innage of 8ft

    Some cases you can only measure the air space "ULLAGE" between the height and liquid, otherwise your measuring device could be destroyed.

  38. #38
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    What you've explained takes me back to highschool days, a long long time ago.
    I wasn't that good with Physics or Math even thought I did always get the logic of it.
    I'm a retired Geologist that worked in IT since 1987

  39. #39
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    So I've managed to manipulate a bit of the code to do what I want, but could use some help / suggestions.

    First I edited the UserForm and made the one box "Hidden"
    Then created a couple frames and grouped a couple boxes.
    Physical Gauges and Side Gauges.

    The Physical Gauge selection works good so far.

    But I'm not sure how to go about setting up the Side Gauge Selection.

    I wanted the user to be able to select at the time of entry what the side gauge relates to innage or ullage, that way the calculation would work. But I couldn't get it to work.

    Also, I notice that not all of Section "B" is working the same? When I fill in "B10", it autopopulates "C10" like it should. But the rest of section "B" doesn't do this? Not sure what I'm missing?
    Attached Files Attached Files

  40. #40
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    I was away for the day.
    I've downloaded your file and will see if I can figure out what you did and why the the 'rest' of B doesn't update

  41. #41
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    You disbaled all the calculations in the code so nothing happens.
    I have no idea of how these are to be done but the section after SideGhg.ClearContents you disabled several lines of code and that is why it doesn't calculate

  42. #42
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    You will have to build the calculations in this section:

    Please Login or Register  to view this content.
    Where you placed the ' those lines do not calculate anything anymore

  43. #43
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Oh, and yes, when B10 is updated, C10 is made equal that was in your initial formulas too, C, E and G where made equal to the column before

  44. #44
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    I've adjusted it to calculate section D & F at the same time now using:

    Please Login or Register  to view this content.
    I'm still testing it to see if it's working as needed.

  45. #45
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Okay, looking forward to seeing the results

  46. #46
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Got dragged away, haven't had a chance to play with it anymore.

  47. #47
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    No problem just post when you've got it going or get stuck

  48. #48
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Now that I'm thinking about it, I should probably have another ValidateInputForm. Just like the first one, but without the option buttons, so the users can't constantly change INNAGE/ULLAGE options on each cell. Those options only need to be available when the user is entering data into section "B". After that, it's just the straight data input.

  49. #49
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    How would I go about using multiple intersect options?

    Meaning:

    If user clicks in range "B10:I10" Is Nothing Then
    open userform1

    If user clicks in range "B11:I11" Is Nothing Then
    open userform2

    If user clicks in range "B13:I13" Is Nothing Then

  50. #50
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Hmm, I've tried several different ways of making it work the way I'd like it but keep failing miserably. Driving me insane

  51. #51
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Can you attach what you've got thus far?
    I'll take a look some time later, maybe tomorrow (I'll check when I wake up), I'll be away as of Friday so it won't be until after the weekend

  52. #52
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    I blew it all away and came back to the last known working code so I have something to work with again. The problem is, I need to figure out how to make the code realize that:

    Please Login or Register  to view this content.

    I know what I listed above isn't correct, as I've tried it multiple times, different ways but can't seem to figure it out.

  53. #53
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    You want two userforms, one a simple one, like the first one probably and one like the one you modified?

  54. #54
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Please Login or Register  to view this content.
    OK I finally made something work!!!! I know there's got to be a better way of streamlining the code so its not duplicated isn't there?
    Attached Files Attached Files

  55. #55
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Actually thinking of using 3 user forms now, but wanted to figure out how to use 2 first.

  56. #56
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    attach the final copy if you want me to take a look.
    I'm off to bed here. Tomorrow I'll be busy and then will be away Friday though Sunday

  57. #57
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Please Login or Register  to view this content.

  58. #58
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Ok Heres my last change of the night here. So far it's working almost as I'd like it, some tweaking here and there and it'll get there. There's a couple issues I need to figure out to make so it works correctly. Any feedback on how to clean it up is appreciated.

    Please Login or Register  to view this content.

  59. #59
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    This doesn't help me at all, your code looks okay but I have no clue about the userforms you're using. I don't have them
    So file (?) with the macro's?

  60. #60
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Sorry about that. The last file I uploaded should have had the user-forms I'm using? Let's see what I can come up with today
    Attached Files Attached Files

  61. #61
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Well Keebellah you got me started now lol. I'm revamping yet again.

    I redesigned the user input form so I believe it make more sense now, instead of having to right click on each cell to edit it individually. Here's where I'm stuck, I don't know how to go about coding each text box to each individual cell it relates to so that once the user is done entering data into the form, it populates the sheet with users input.

    When you get a chance, could you please take a look at it and let me know if I'm on the right track and also try to assist in making some magic happen with it.

    I'll keep at it and update the thread as I progress through it. Again I appreciate your feedback and all the help you've provided so far.

    Thanks,
    Attached Files Attached Files
    Last edited by midnightorion; 09-29-2017 at 11:32 AM.

  62. #62
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    I can't seem to figure out how this string works? I want to have the Label Read from ROW 2 now, which I figured that part out, but can't seem to be able to figure out how to make it read the correct cell. I want it to read the cell "B6" and then "Open", if I'm working in the "Open" Section of the form, or Read "B6" and then "Close" if I'm in the "Close" section of the form, then read into next section D, F & H when working in those areas.

    Please Login or Register  to view this content.

  63. #63
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    I'll see what I can do for you.
    Let me take a look and see if I understand what you want since I still have no idea what the user will be filling in.
    My idea would be that one for to fill all data from one column and process that an do that for each column separately.
    I never understood (in your first code) why C10 would be = B10 and E10 = D10, etc.
    So without understanding the calculations it wil take some time.
    Like I mentioned. I'll be away for the weekend starting tomorrow.

  64. #64
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    The form is used to track measurements.

    So In Cell B6 would go an ASSETS name. Lets say CUP-1.
    Then the user goes to CUP-1 and physically measures its liquid contents before something goes into or comes out of it. "OPEN".
    The user will take his/her measurements and look up a volume from a chart designed for CUP-1. This volume isn't used on this form. But that physical measurement is added in Section "C"
    The user will use the Chart to get a Fixed Gauge Height "The Benchmark, Section B." Hence why B10 and C10 equal the same value, as it will be the same fixed point used for measuring OPEN & CLOSE.
    Also on the Asset, CUP-1 there is a computer reading which shows what it's measurement is. This gets entered into Section AA, for comparison purposes.

    All sections may need a manual entry if for some reason the scope of the calculations don't fit the criteria.

    Also, please don't go out of your way to help. If your busy or enjoying time off, please enjoy the time off. I can wait and play by trial and error in the mean time.

    Thanks again,

  65. #65
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Okay, thanks for this explanation, I'm starting to get the picture.
    And yes, don't worry, I'll take my time-off but like I always do, ideas always pop-up any time of the day.
    I have a 10" Transformer with me Windows 10 and Office 2016 on it where I write down my thoughts to workout and that sometimes also serves as a good development system when on-the-road.
    But after Monday I'll be able to put in some time.

  66. #66
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    Hi, got back yesterday and will take a look at your file this afternoon.
    One question, when you select ULLAGE or INNAGE you change the text accordingly but, will you always do the same calculations for column B, D or F?
    That means that if you do ULLAGE for B and decide on INNAGE for D the text for that row in Column A will not coincide.

  67. #67
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201
    Quote Originally Posted by Keebellah View Post
    Hi, got back yesterday and will take a look at your file this afternoon.
    One question, when you select ULLAGE or INNAGE you change the text accordingly but, will you always do the same calculations for column B, D or F?
    That means that if you do ULLAGE for B and decide on INNAGE for D the text for that row in Column A will not coincide.
    That's correct, the idea is that if a user needs to do a different gauge innage or ullage, they can create a new sheet and use that one for the other measurement.

  68. #68
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    I'm really stuck from here.
    I've added the control items to check and see if the entered values are correct. you will have to complete it by placing the correct value in the correct cells and do your calculations.

    The textboxes 11 through 20 are populated accordingly

    I did not change the version nr of the file
    Attached Files Attached Files

  69. #69
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    Thanks Keebellah I'll check this out first thing tomorrow morning. I'm sure I'll a ton of questions as I get into it. Again, appreciate the time you took to help out.

  70. #70
    Forum Contributor
    Join Date
    07-12-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: VBA Data Validation

    I keep going to play with this but every time I do, I run out of time. Weddings, funeral, work

    Anyway, I can't seem to get the grasp of what you did. It doesn't seem to calculate or populate the form anymore? I need to adjust the data validation for the upper, middle and lower text boxes. Those will be for temperatures. I think I figured that out though. You think you can add little explanations to sections of the code, so I know whats doing what?

    What are your thoughts on splitting code up and using GoTo if Intersect area is used? I'm thinking that if I use a seperate module for each Asset, CUP1, CUP2 etc. I can better manage the calculations so I know where each sections at, that and also not having to recalculate the entire form each time I adjust 1 measurement for an asset.

    Thanks for any feedback and suggestions.

  71. #71
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA Data Validation

    In #68 I explained that I only placed the code for the different textboxes, no calculations.
    Your file (the last one) also missed the calculations.
    The idea would be to carry out the calculations in the userform and update the result textboxes when you press OK and then update the worksheet before unloading the form

+ 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. Multi-select from data validation isn't working with auto-assigning data validation
    By iPenguin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-11-2017, 12:37 PM
  2. Replies: 3
    Last Post: 06-04-2015, 02:27 PM
  3. [SOLVED] Data Validation: How to clear/delete the content of the cell and not Data Validation List?
    By lukelucky in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-07-2015, 09:42 AM
  4. Replies: 4
    Last Post: 07-03-2014, 02:37 AM
  5. Replies: 4
    Last Post: 12-19-2013, 10:44 AM
  6. Adding Date Data Validation to cells with List Data Validation
    By biggtyme in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-03-2013, 09:47 AM
  7. Using Defined Names with Data Validation Depend and Data Validation Multi Select
    By Vinnie Chan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-01-2012, 05:36 PM

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