Adding a new way to input Data into Excel

EE Pros...... HAPPY NEW YEAR!

I am looking for a easy way for users to input some simple information.  I've attached a sample of what I'm looking for.  Basically, it's taking perhaps a Form (open to any approach) and have the ability to input two variables (Amount per month and Number of Months) and have the product placed in a particular cell.  The Form or input capability must be triggered by some action.... I was thinking about a triple click on the specific cell for the Form to come up and then a click on the Form to extract it.  If the User doesn't want to use the Form (i.e. they put the amount in themselves, they can put it in without firing the Form up.

Got it?  

Questions, ideas or a solution is welcome!

Thank you in advance,

B.
Adding-a-input-capability.xlsm
Bright01Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Excel amusantCommented:
Hi Bright01, Happy New Year!

Do you want something like this? Please see attached. Click on the macro button fill the number of months and value per month and you will get the desired output in Cell f7.
Adding-a-input-capability.xlsm
Excel amusantCommented:
Or these two

Whenever cell F7 is selected the Macro will automatically runs. or Attachment (V3) Whenever cell F7 is selected the a msgbox appears asking whether you want to run the macro or not.

See attached examples. Select Cell F7 and follow the macro.
Adding-a-input-capability--v2-.xlsm
Adding-a-input-capability--v3-.xlsm
Bill PrewIT / Software Engineering ConsultantCommented:
Not sure if I understood what you wanted, but give this a try.

If you just click into the two cells you mentioned, you can type a value.  If you double click into the cells, then an input form will pop up and values can be entered, and the result placed in the cell when OKAY is pressed.

I didn't go crazy with formatting or error checking, but this should give you some ideas.

~bp
EE28913525.xlsm
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Bright01Author Commented:
Bill, will take a look.  Excel amusant,  #2 is close.  You should be able to enter your own number in the cell (Cell F7) OR, by either clicking or hovering, have the question form come up.  Can you combine the input data into the form so that you can put both $ / Mo. And # / Mo. In the same box?  Then the amount is placed in the same box....F7.  And after the data is entered the box can close. The example below was to show what it looked like once the data was entered.
Adding-a-input-capability--v2-.xlsm
Bright01Author Commented:
Bill, closest yet!  That's what I'm looking for.  Doubleclick on the cell and up comes the box to enter the simple data.  The math then puts the product back into the box.  Can you set it up so that I can do multiple cells?  + error checking?  Is it contained in the WS or a module?  Better in the specific worksheet since I have my production version in multiple WSs and wouldn't need this capability anywhere else.
Bill PrewIT / Software Engineering ConsultantCommented:
It does currently support multiple cells, take a look at the VBA code associated with Sheet1 (also included below).  Notice the check for which cells to enable this on.

There is some basic editing for numeric values, what additional editing would make sense.  That can be added to the btnOkay_Click event in the VBA code associated with the button in the frmData form (also included below).

That is all the code that was needed, and the form itself.  The form and it's VBA resides in the Workbook, while the triggering logic lives in the VBA associated with Sheet1.

Sheet1 VBA code
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   If Target.Address = "$F$7" Or Target.Address = "$F$20" Then
      frmData.Show
   End If
End Sub

Open in new window

frmData VBA code
Private Sub btnOkay_Click()
   With Me
      If .txtDollars <> vbNullString And .txtNumber <> vbNullString Then
         ActiveCell.Value = .txtDollars.Value * .txtNumber
      End If
      .Hide
   End With
End Sub

Private Sub txtDollars_Change()
    NumberEdit
End Sub

Private Sub txtNumber_Change()
    NumberEdit
End Sub

Private Sub NumberEdit()
    If TypeName(Me.ActiveControl) = "TextBox" Then
        With Me.ActiveControl
            If Not IsNumeric(.Value) And .Value <> vbNullString Then
                MsgBox "Only numbers allowed"
                .Value = vbNullString
            End If
        End With
    End If
End Sub

Open in new window

~bp
Excel amusantCommented:
Please see attached.

Now anywhere you double click the macro will run. If you want only to enable double click in Cell F7 & F20 then replace the existing module with the following code in worksheet event.

 
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
 
 If Target.Address = "$F$7" Or Target.Address = "$F$20" Then
        Call test
        
        End If
  
End Sub

Open in new window

Adding-a-input-capability--v2-.xlsm
Bright01Author Commented:
Looking at both of these great examples......

Bill, if I wanted to add say, 5 cells that have this capability, how would I change this part of the code (such as what you have put here for F7 and F20)?  In other words, what if I have a list of these cells?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   If Target.Address = "$F$7" Or Target.Address = "$F$20" Then
      DataEntrySaaS.Show
   End If

BTW; I changed the name of the Form.

B.
Bill PrewIT / Software Engineering ConsultantCommented:
How about this approach:

   Select Case Target.Address
      Case "$A$1", "$F$7", "$F$20"
         frmData.Show
   End Select

Open in new window

~bp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bill PrewIT / Software Engineering ConsultantCommented:
Another approach would be to place all the cells you want this to occur on into a named range, and then test for that in the double click event.  Here's an example of that, testing against the named range "Popup".

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   If Not (Application.Intersect(Target, Range("Popup")) Is Nothing) Then
         frmData.Show
   End If
End Sub

Open in new window

~bp
Bright01Author Commented:
But when using "range names" the cells have to be contiguous right?

B.
Bright01Author Commented:
Hey guys!  Great job.  Both solutions worked; however, I can only use one.  What's really great when you guys do this, I really learn a lot.

Again, much thanks and happy 2016.

B.
Bill PrewIT / Software Engineering ConsultantCommented:
Thanks for the feedback, glad that was helpful.

No, cells in ranges do not have to be contiguous, they can just be a list of cells.  For example for testing I created the range that looked this way.

sshot-71.png~bp
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.