Defining Cell Values from VBA UserForm

austie

New Member
Joined
May 29, 2018
Messages
14
Hi All,

1st time posting and its been over 10yrs since I've used my VBA skills so please accept my appolgise if I have rehashed anything in the forums but so far I've not found a solution.

I've created a userform which is entering data into spreadsheet.

I'm have some issues with defining the properties of text boxes being auto converted to a value when pasting in the spread sheet.
Day Requested - I've tried using date picker but I have not worked out how to get it to convert so I've gone to a text box for now, this needs to convert a date to day of the week (ie. 2/6/2018 = Saturday)
Time Required - I've used drop downs and others but I need 3 options here where the end user can enter either "AM" "PM" or a custom time frame option
Contact Number - I need to have this convert to a number format without dropping the 0 at the start. Only way I've worked this out is to be custom text

I'm also having some issues with defining and sorting enteries but if I can get these 3 fields fixed then I'm sure the rest should be easier.


Code:
Dim wb As Workbook
Dim ws As Worksheet
Dim LValue As Date
Dim FirstCell As String
Dim LastRow As Long
Dim i As Integer

FirstCell = "A6"
Range(FirstCell).Select
Set wb = ThisWorkbook
Set ws = wb.Sheets("Daily Job List")
LValue = Now

Do Until ActiveCell.Value = ""
If ActiveCell.Value = "" Then
Exit Do
Else
ActiveCell.Offset(1, 0).Select
End If
Loop

LastRow = ws.Range("A" & Rows.Count).End(xlUp).Row + 1

ws.Range("A" & LastRow).Value = Daytxt.Text
ws.Range("B" & LastRow).Value = Timetxt.Text
ws.Range("C" & LastRow).Value = Jobnotxt.Text
ws.Range("D" & LastRow).Value = Ordnotxt.Text
ws.Range("E" & LastRow).Value = CompNametxt.Text
ws.Range("F" & LastRow).Value = ContactTxt.Text
ws.Range("G" & LastRow).Value = ContNotxt.Text
ws.Range("H" & LastRow).Value = Delivertxt.Text
ws.Range("I" & LastRow).Value = TypeCombo.Text
ws.Range("J" & LastRow).Value = Amounttxt.Text
ws.Range("N" & LastRow).Value = LValue


That formula pasts the values into the spreadsheet then closes the form, have a similar one that enters then clears the form ready for use again.
Thanks all for any assistance
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Cross-posted: https://www.excelforum.com/excel-pr...5-defining-cell-values-from-vba-userform.html

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,214,901
Messages
6,122,157
Members
449,068
Latest member
shiz11713

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