View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ivan Hung Ivan Hung is offline
external usenet poster
 
Posts: 3
Default Copy from sheet1 and sheet2 and append to sheet3 in different format

Hi,
I am learning VBA Excel and have attempted this, but can't seem to get it to
work together.

I have sheet1, sheet2 and sheet3 in the same workbook. I would like to
append data (value only) from sheet1 and sheet2 and append to the last blank
row on sheet3. I have the following information on the sheet1 and sheet2,
what I would like to have is sheet3. Can someone help me out?

Sheet1
A B C D E F
G H I J K L M
N
Name PayCAT 1-Apr-09 1-May-09 1-Jun-09 1-Jul-09 1-Aug-09 1-Sep-09 1-Oct-09
1-Nov-09 1-Dec-09 1-Jan-10 1-Feb-10 1-Mar-10
Peter Base 10,000 10,000 10,000 10,000 10,000 10,000
10,000 10,000 10,000 11,000 11,000 11,000
John Base 12,000 12,000 12,000 12,000 12,000 12,000
12,000 12,000 12,000 13,000 13,000 13,000

Sheet2
A B C D E F
G H I J K L M
N
Name PayCAT 1-Apr-09 1-May-09 1-Jun-09 1-Jul-09 1-Aug-09 1-Sep-09 1-Oct-09
1-Nov-09 1-Dec-09 1-Jan-10 1-Feb-10 1-Mar-10
Peter Bonus 0 18,000 0 0 0
0 0 0 10,000 0 0 0
John Bonus 0 20,000 0 0 0
0 0 0 12,000 0 0 0

Sheet3
A B C D
Name PayCAT Month Amount
Peter Base Apr-09 10,000
John Base Apr-09 12,000
Peter Base May-09 10,000
John Base May-09 12,000
Peter Bonus May-09 18,000
John Bonus May-09 20,000
Peter Base Jun-09 10,000
John Base Jun-09 12,000
Peter Base Jul-09 10,000
John Base Jul-09 12,000
Peter Base Aug-09 10,000
John Base Aug-09 12,000
Peter Base Sep-09 10,000
John Base Sep-09 12,000
Peter Base Oct-09 10,000
John Base Oct-09 12,000
Peter Base Nov-09 10,000
John Base Nov-09 12,000
Peter Base Dec-09 10,000
Peter Bonus Dec-09 10,000
John Base Dec-09 12,000
John Bonus Dec-09 12,000
Peter Base Jan-10 11,000
John Base Jan-10 13,000
Peter Base Feb-10 11,000
John Base Feb-10 13,000
Peter Base Mar-10 11,000
John Base Mar-10 13,000

I would like the user to be prompted with the dialog box for current month
in the format "dd-mmm-yy", if the user input is invalid (outside the date
range on sheet1), then prompt user again, if user input is blank, then clear
data on sheet3 and copy 12 months data from sheet1/sheet2 and append to the
last blank row on sheet3, otherwise only copy the current month data from
sheet1/sheet2 and append to the last blank row on sheet3.

In addition, if the amount on sheet1 or sheet2 is zero, no record for the
month will be appended to sheet3.

Any response would be greatly appreciated!

Many thanks,
Ivan