Increment input value by a month on entry

julhs

Active Member
Joined
Dec 3, 2018
Messages
409
Office Version
  1. 2010
Platform
  1. Windows
This is for use on a UserForm.

In my reference list for “cmbReceiptsFrom”, I have one set as “aaa (April)”
How can I increment the month by ONE every time I select “aaa (April)” from the “cmbReceiptsFrom” list and THEN make the “Add Entry”.

It does ENTIRELY really on looking back up Column C for the last instance of “aaa (???) and changing it so it is the next month.
Eg;- last instance in Col C was “aaa (June)”, the next time I select “aaa (April)” from “cmbReceiptsFrom” and then "Add Entry", the entry in Col C will read “aaa (July)”

Having the “UserForm” to displaying the next consecutive month is not important; but maybe helpful.
It just needs to change the last instance of “aaa (????)” in Col C to “aaa (The Next consecutive month )” when “Add Entry” is made.

This is the code for “Add Entry”
VBA Code:
Private Sub cmdAddEntry_Click()
   Dim LastRow  As Long                               
   Dim ws       As Worksheet

   Set ws = ThisWorkbook.ActiveSheet                        
                      LastRow = ws.Cells(Rows.Count, 1).End(xlUp).Row + 1               
         With ws  
                                 '********* This takes the values from the ComboBoxes and places them in the respective columns
               .Cells(LastRow, "A") = Format(Me.Calendar1.Value, "mmm/dd")
               .Cells(LastRow, "C") = Me.cmbReceiptFrom
               .Cells(LastRow, "D") = Me.txtItemValue.Value

Hopefully I have uploaded enough of the "Full UserForm" code to make an answer possible??
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,215,440
Messages
6,124,882
Members
449,193
Latest member
PurplePlop

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