Solved

populat days of month

Posted on 2014-09-17
3
67 Views
Last Modified: 2014-10-06
I would like to populate the days ot the month to the right of l5 based on user input.the most efficient and quicket way.
thankss
Book1dates.xlsm
0
Comment
Question by:Svgmassive
3 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 250 total points
ID: 40327670
Please find attached.
Book1dates.xlsm
0
 

Author Comment

by:Svgmassive
ID: 40327713
can we also do in vba.thanks
0
 
LVL 27

Assisted Solution

by:Glenn Ray
Glenn Ray earned 250 total points
ID: 40328622
Add this code to the Sheet object in VBA:
Option Explicit
Dim c As Integer
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$L$5" Then 'show dates for month
        For c = 0 To 30
            If Month(Target.Value + c) = Month(Target.Value) Then
                Target.Offset(0, c + 1).Value = Target.Value + c
            Else
                Target.Offset(0, c + 1).Value = ""
            End If
        Next c
    End If
End Sub

Open in new window


It will populate the cells to the right, starting with the data specified in cell L5, to the last day of the month.  It does not check that the date in L5 is ACTUALLY the first date of the month.

Example file attached.

-Glenn
EE-Book1dates.xlsm
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now