Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro for checking data in a cell against another cell andcopying/pasting data
I have a workbook with multiple sheets, what I want to do is create a
macro that will check the date in one cell on sheet 1 against the date on a cell in sheet 2, if they match I want it to copy the data from F5:F22 on sheet 1 (named current month) and paste to sheet 2 (named data) in the rows under the cell where the date was found; Example: May-12 is in column AD, so I want to paste the data into AD3:AD20, then in June it will shift a column to AE3:20. Here is where it gets tricky though, I need the macro to also check the number and see if the meter rolled over (EG. 99999 to 00002) and if it did I need it to basically adapt that to what it would have been if it hadn't rolled over (EG. take 99999 and add 00002 to get 100001). So it will need to take sheet 1 (current month) F5:22 and compare it to E5:22 and if the number in F5:22 is lower than E5:22 it will need to add the number from G5:22 to E5:22 and then paste the result of that. It would also be handy if the macro could annotate the cell with a note like "rolled over" on it so we can track how fast these meters roll over. I have the following formula in cells G5:22 to account for a roll over: Code:
=IF(F16<E16,(F16+1000000)-E16,F16-E16) the first page to show the proper amount of usage. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Data Validation - Do not want to allow pasting into the cell | Excel Programming | |||
Why does data validation not work when pasting data into a cell. | Excel Discussion (Misc queries) | |||
How do I stop cell borders dissappearing when pasting data? | Excel Worksheet Functions | |||
Pasting data top 1st empty cell in range | Excel Discussion (Misc queries) | |||
Checking if a cell is filled up with data | Excel Discussion (Misc queries) |