Populating worksheet with a range of dates from a UserForm

shaeto

New Member
Joined
Jun 12, 2013
Messages
3
Greetings,

I'm making my way up slowly but surely to get better at VBA coding but the road is still long thus I humbly request for any assistance from your side :pray:

I actually have a worksheet as per below:
ABCD
1DateItem XItem YItem Z
2
3
4
5

<tbody>
</tbody>
The sheet is populated with data from a UserForm with the following objects on it:
  • Start Date: (Label1) - Text box (TextBox1)
  • End date: (Label2) - Text Box: (TextBox2)
  • Item X: (Label3) - Text Box (TextBox3)
  • Item Y: (Label4) - Text Box (TextBox4)
  • Item Z: (Label5) - Text Box (TextBox5)
  • Save - (CommandButton1)

I actually can't get the VBA code right which will populate the worksheet as per below once I fill in the UserForm and hit the 'Save' button

USERFORM
Start Date: 01/01/2019 End Date: 01/03/2019

Item X: ABCD

Item Y: EFGH

Item Z: IJKL

SAVE

<tbody>
</tbody>

ABCD
1DateItem XItem YItem Z
201/01/2019ABCDEFGHIJKL
301/02/2019ABCDEFGHIJKL
401/03/2019ABCDEFGHIJKL
5

<tbody>
</tbody>

Additionally if any date within the range is a Sunday, same must not be listed in the worksheet.

Finally in case the 'Start Date' and the 'End Date' are the same date, then only one row is to be filled.

That is:

USERFORM
Start Date: 01/11/2019 End Date: 01/11/2019

Item X: MNOP

Item Y: QRST

ItemZ: UVWA

SAVE

<tbody>
</tbody>

ABCD
1DateItem XItem YItem Z
201/01/2019ABCDEFGHIJKL
301/02/2019ABCDEFGHIJKL
401/03/2019ABCDEFGHIJKL
501/11/2019MNOPQRSTUVWA

<tbody>
</tbody>


Thank you beforehand for your valuable help.

Cheers

Shameem
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,216,101
Messages
6,128,835
Members
449,471
Latest member
lachbee

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