Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Pivot Table Data with Column "Sum" rather than "count" defa Johnny_99[_2_] Excel Discussion (Misc queries) 2 January 2nd 10 03:25 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Excel "Move or Copy" and "Delete" sheet functions dsiama Excel Worksheet Functions 1 December 28th 07 01:57 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Please add a "sheet" function like "row" and "column" functions Spreadsheet Monkey Excel Programming 2 November 8th 05 04:08 PM


All times are GMT +1. The time now is 04:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"