Adding Records to Different Worksheet in the work book - based on Date - month wise

Pramod KLN

New Member
Joined
Dec 24, 2017
Messages
3
Hi Every one,

I am a new member in to the family of Mr.Excel, and also new to VBA programming. I have created a workbook for Sales Data Entry. Which contains different worksheets, namely "Party Details" and month wise sheets for sales Data as Apr-17, May-Say and so on.

I have created a userform to enter customer details in to the worksheet "Party Details" and it is working fine.

I have created a userform for Sales Data Entry which picks Party Name from "Party Details" , other fields are S.No. Invoice Date Invoice Amount.

Now what I want is Whenever I Enter the Invoice Date, it should open that particular month Sheet, go to last row and update Next S.No, Invoice No, Invoice Date, Invoice Amount etc,,

Is it is possible to write VBA code for this?

I have created different sales sheets month wise only file monthly Sales Returns easily.

The otherway round is keep only worksheet for the sales Data entry and later filter month wise.

Thanking you in advance.

Pramod
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I can think of two ways I would go about this. Either I would have hard coded logic like:

Code:
dim yoursheet as worksheet

if month(Invoicedate) = 1 then
    set yoursheet =workbooks("Workbook.xlsx").Worksheets("January")
Elseif month(Invoicedate) = 2 then
    set yoursheet =workbooks("Workbook.xlsx").Worksheets("February")
...

Endif
or a more delicate solution, is doing something like

Code:
    dim yoursheet as worksheet
    set yoursheet =workbooks("Workbook.xlsx").Worksheets(Monthname(month(InvoiceDate)))
    ..... whatever operations on yoursheet here

If your tabs are just called january etc the above will work, of can combine with other things like

Code:
     set yoursheet =workbooks("Workbook.xlsx").Worksheets(Monthname(month(InvoiceDate)) & " Data")


You could also just have a key on a hidden sheet that has the name of each sheet based on each month, and do an index match. There are a lot of options :)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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