Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi All
I have received the following macro from Greg Wilson. I copies down a range into respective month sheet and date column based on date (C2). I created the month sheets manually. What i need is the macro should check whether the month sheet is created or not. If it is not, create month sheet and copy else copy the range. Sub k() Dim r As Range Dim m As Integer, d As Integer Dim msg As String, ttl As String Dim sheetnames As Variant sheetnames = Array("Jan", "Feb", "Mar", "Apr", "May", _ "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec") With Sheets("Data") With .Range("C2") If Not IsDate(.Value) Then msg = "Error: Date not entered in cell C2" ttl = "Student Attendance" MsgBox msg, vbCritical, ttl Exit Sub End If m = Month(.Value) d = Day(.Value) End With Set r = .Range(.Cells(3, 5), .Cells(3, 5).End(xlDown)) End With With Sheets(sheetnames(m - 1)).Cells(3, d).Resize(r.Count) ..Value = r.Value End With Set r = Nothing End Sub With regards Sreedhar |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro modification question | Excel Discussion (Misc queries) | |||
Macro Modification | Excel Worksheet Functions | |||
Macro Modification | Excel Worksheet Functions | |||
Macro modification | Excel Discussion (Misc queries) | |||
Macro Modification Help | Excel Worksheet Functions |