Excel VBA Userform Help

tdm1103

New Member
Joined
Mar 31, 2011
Messages
19
Hi,

I have created an "Issue" log in excel where the macro is clicked and the user can fill out the userform that when submitted automatically populates the excel sheet and assigns it a "Ticket #". I have a separate Macro that is used to select a "Ticket #" so that the information can be updated and that information is dropped into different cells.

My issue:
In each userform I have a "Date" field where the date is automatically populated. No problems at all when submitting a new issue. The date is submitted to column C.

In the update issue userform the "Date" field is again automatically populated with current date and once submitted is populated in column G. When the "Ticket #" is selected though it wipes out the automatic date in the userform because the cell in column G is blank.

Is there a way where once the ticket is selected the "Date" field will not be wiped out?

Thanks
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Seems at the end of the code for the selected ticket - you need to write current data/time to the date field.

Alternative activate the event for DateField_change on the userform - in that event check

if value(text)=vbnullstring then make it equal current Date/time.

Hope this helps
 
Upvote 0
Thanks for getting back to me so quickly. Sorry for the dumb question (I am new to VBA) how do I "activate the event for DateField_change on the userform?
 
Upvote 0
bring up the userform in design mode - (where you add the controls)

Now double click the control - this brings you to the code section i.e. Commandbotton1_click - so the name of the control is CommandBotton1 and the event is the _click.

Right above the code lines you will see two drop downs - the one to the left is to select which conrol - the one to the right shows all the events available for the selected control - these would be Click - change mousedown and so on.

Also goto the top and click on view - then select "Project Properties" - if you are not sure how properties work - then study activeX controls - most of the controls are AxtiveX componets. essentially there is 3 ways to interact with an activeX - inputs/Outputs/Events - The Input allow you to both read and set Properties - so outputs is seledom used as you can use the inputs to read and set properties - The events is where a flag is raised. Keep in mind that VBA is event driven - anyways - find some articles read up on this a bit - it will explain it better than I can.

Good Luck

The best may be for you to find a simle code on the net and just mess around a bit.
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,681
Members
452,937
Latest member
Bhg1984

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