We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
Adding a default todays date to VB Excel Form
robert_harper_2000
Posts: 1,501 Forumite
in Techie Stuff
I would like as the heading says lol add a default value of todays date
Private Sub txtdate_Change()
End Sub
I've tried =date()
What is it?
Private Sub txtdate_Change()
End Sub
I've tried =date()
What is it?
Help me to help you :santa2:
0
Comments
-
Try....
=now()
and then format the cell to whichever date format you prefer.
HTH.
Mr_F.0 -
Thanks but it isn't that.... this is for the visual basic program form.
I think it needs something fancy nothing that something simple would do it lol
Cheers anywayHelp me to help you :santa2:0 -
textbox.text=date(date_format) I guess. VB help not installed on my home machine so I'll have to check at work tomorrow.
Look in VB help.Happy chappy0 -
Private Sub UserForm_Initialize()
txtDate.Text = Date
End Sub0 -
Once again, you do it again!
lol Cheers guys... although another quick prob no big deal ...
My users need to click on the add button once (which enters all the info except the customer number) and twice for the customer number.
I want a one click does it all
That includes a clear function to show the user it has been entered in .. CHEERS :beer:Help me to help you :santa2:0 -
What add button methods are listed then?
ie: Add_Button_Click
Putting in break points by clicking on the left hand side of the code window can help you see whats happening.Happy chappy0 -
That was answered in your other thread.robert_harper_2000 wrote:That includes a clear function to show the user it has been entered in
Put
txtpet.text = ""
txtqty.text = ""
etc.
after the statements which transfer the textbox values.0 -
I tired adding it
Private Sub cmdAdd_click_Click()
'Declare variable intNext as an integar'
Dim intNext As Integer
'Set the value of intNext to be the number of rows in Dataset'
intNext = Range("Dataset").Rows.Count + 1
'Transfer the values in the form into the spreadsheet'
Range("A" & intNext) = txtNumber.Value
Range("B" & intNext) = txtpet.Value
Range("C" & intNext) = txtqty.Value
Range("D" & intNext) = txtprice.Value
Range("E" & intNext) = txtstaff.Value
Range("F" & intNext) = Txtname.Value
Range("G" & intNext) = txtAddress.Value
Range("H" & intNext) = txtphone.Value
Range("I" & intNext) = txtdate.Value
Range("J" & intNext) = txtcomments.Value
'Runs the nextNumber procedure to display the next available number'
Call NextNumber
'Move the cursor to txttitle'
txtpet.SetFocus
End Sub
I added it under the Range("J" & intNext) = txtcomments.Value
txtnumber.text = ""
txtpet.text = ""
etc but it doesn't accept it .. .any ideas?Help me to help you :santa2:0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 352.5K Banking & Borrowing
- 253.7K Reduce Debt & Boost Income
- 454.5K Spending & Discounts
- 245.5K Work, Benefits & Business
- 601.4K Mortgages, Homes & Bills
- 177.6K Life & Family
- 259.4K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards