Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
find "Cancellation" in column "A" and copy all data from Columns B-F onto another Sheet
Need help writing code for a month change event. At the beginning of
each month, the user will enter the new month's number (i.e. Feb = 2, Mar = 3, etc) and the macro will go to the previous month's tab (i.e. user selects 2 for "Feb", macro would go to "Jan" tab), search in Column "A" for any and all cells that have the word "cancellation" and copy the data in columns B-K to the "Summary" tab in the next blank row, starting in column B. Would also be very nice to have it automatically fill in the month name in Column A of the Summary Tab (i.e. if user selects month 2, the month to insert in column A would be "January"). If anyone can help I'd appreaciate it. Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
find "Cancellation" in column "A" and copy all data from Columns B
Sub test1()
'get month name OldMonthName = MonthName(ActiveCell.Value - 1) RowCount = ActiveCell.Row + 1 With Sheets(Left(OldMonthName, 3)) Lastrow = .Cells(Rows.Count, "B").End(xlUp).Row For MonthRowCount = 1 To Lastrow If .Cells(MonthRowCount, "A").Value = "Cancellation" Then ActiveSheet.Range("A" & RowCount).Value = OldMonthName .Range("B" & MonthRowCount & ":K" & MonthRowCount).Copy _ Destination:=ActiveSheet.Range("B" & RowCount) RowCount = RowCount + 1 End If Next MonthRowCount End With End Sub "bjohnson" wrote: Need help writing code for a month change event. At the beginning of each month, the user will enter the new month's number (i.e. Feb = 2, Mar = 3, etc) and the macro will go to the previous month's tab (i.e. user selects 2 for "Feb", macro would go to "Jan" tab), search in Column "A" for any and all cells that have the word "cancellation" and copy the data in columns B-K to the "Summary" tab in the next blank row, starting in column B. Would also be very nice to have it automatically fill in the month name in Column A of the Summary Tab (i.e. if user selects month 2, the month to insert in column A would be "January"). If anyone can help I'd appreaciate it. Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Create Pivot Table Data with Column "Sum" rather than "count" defa | Excel Discussion (Misc queries) | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Excel "Move or Copy" and "Delete" sheet functions | Excel Worksheet Functions | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Please add a "sheet" function like "row" and "column" functions | Excel Programming |