Populating a calendar with VBA

  • Thread starter Thread starter allenlance
  • Start date Start date
A

allenlance

Hello,

I have a customer record spreadsheet where each row represents a
different customer. Each record has a "due date" and several
customers can have the same due date. I'm trying to generate a
calendar from this data showing the customer's name on the calendar
day that corresponds to their due date. Creating the calendar isn't
the problem - it's populating it that I'm having trouble with.

Any ideas?
 
I'm not sure if this is what you're looking for -- and I really haven't
filled in all of the details. First, my data is in (A1:B10). A has the
name, B has the date. All of the dates in this example are in the same month.

My "calendar" is (D1:?31) -- the "?" depends on how many names are in a date.

The following code fills out my calendar:

Public Sub test()
Dim r As Range
Dim cc(31) As New Collection
Set r = Range("A1:A10")
For Each c In r
cc(Day(c.Offset(0, 1))).Add c
Next
For i = 1 To 31
For j = 1 To cc(i).Count
Cells(i, j + 3) = cc(i).Item(j)
Next
Next
End Sub

I hope this is of some use.
 
I understand my original question was very broad and a bit complex but
in case anyone was interested in a solution then here you go!

It works marvelously.

I built an addin that takes a spreadsheet and configures the raw data
for export to a csv file. This csv file is then used by an external
app named "XL Calendar". This app is available at LJZSoft.Com. It's
a very basic calendar app that creates the user's calendar in an excel
file. The wonderful feature is that it will take a custom "holiday"
file and import it that into your new calendar. By modifying my data
into the format used for the "holiday" file I was able to create a
caledar showing all of my customer due dates. I created a secondary
macro built into my add-in to further format the calendar to allow for
a lot of data to be packed into each day on the calendar.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top