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
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Watch MrExcel Video

Forum statistics

Threads
1,112,821
Messages
5,542,690
Members
410,568
Latest member
jmagasan
Top