User Form Question

Guzzlr

Well-known Member
Joined
Apr 20, 2009
Messages
964
Office Version
  1. 2016
Platform
  1. Windows
Hello All,
I'm having a little difficulty with learning about User Form's

My Code Thus Far:
Code:
 [COLOR=#339933]'While Loop Checks for Data Beginning In Line 17[/COLOR] 
RowCounter = 17
    While Cells(RowCounter, 2).Value <> ""
        RowCounter = RowCounter + 1
    Wend    
[COLOR=#339900]'Data Input Into Excel Sheet[/COLOR]
    Cells(RowCounter, 2).Value = Tbx_Date.Text
    Cells(RowCounter, 3).Value = Tbx_Time.Value

So, My User Form has two fields to fill in:
1. "Date Field"
2. "Time Field"

When I fill in the Date Field, the User Form enters the date in RANGE(B17), as it should, and continues with B18, B19 as new dates are entered. So the Date Field is working Correctly.

My "Time Field" is not working correctly. When I enter a number ie: 1.5, the code faults on:
Cells(RowCounter, 3).Value = Tbx_Time.Value

What I'm trying to accomplish, is the Date in B17 and the corresponding time in C18.

Thanks for the help
excel 2013

PS, at this time, I have no declarations, which is probably wrong...
 
Last edited:

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hello All,

Here is my msg box yes/no for my clear Button:
Code:
Sheets("WorkSheet").SelectActiveSheet.Unprotect
If Range("B17") = vbNullString Then
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Exit Sub
End If




ans = MsgBox("Clearing Sheet Will Delete All Clocking Times!" _
& vbNewLine & "Select Yes to Clear all Clocking Times for a New Payroll" _
& vbNewLine & "Select No to Keep Current Payroll Information", vbYesNo, "Clear Paroll Informtion")


If ans = vbNo Then
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Exit Sub
End If


I'm having a little trouble with the User Form input fields. I have two input fields. If I close the User Form, with either one of the two fields blank, I get a Debug mismatch box because. I'm guessing both fields must have an entry...hence the mismatch error.

The problem is I'm not familiar with input fields on a user form to code an If statement with Yes or No msg box. similar to the above (with different message) so both input fields must have an input. if not, the user form remains so the user can input again.
Thanks for the help
excel 2013
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,693
Messages
6,126,248
Members
449,304
Latest member
hagia_sofia

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top