Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
AutoFillDown
Hi,
I've a problem to auto fill down the data from active cell ( say B5 in month1, B7 in month2 ) in column B if auto fill down function is to depend on the availability of column A data The active cell is used because the data is exported that can be placed in any cell of column B If I were to use the following codes in month1, it will give the correct result in month 1 but not in month 2 because it defined the obsolute cell reference, ie cell (5,1)& (5,2) Dim rng As Range Set rng = Range(Cells(5, 1), Cells(5, 1).End(xlDown) rng.Offset(0, 1).Formula = Cells(5, 2).Formula e.g. Month 1 Month 2 A B A B 1 GLP5-00652 2,000.00 GLP5-00652 2,000.00 2 GLP5-00654 3,350.00 GLP5-00654 3,350.00 3 GLP5-00655 1,450.00 GLP5-00655 1,450.00 4 APP5-00312 906.00 APP5-00312 906.00 5 GLP5-01173 - GLP5-01173 453.00 6 APP5-00477 APP5-00477 21.00 7 GLP5-01077 GLP5-01077 - 8 GLP5-01087 GLP5-01087 9 APP5-00480 APP5-00480 10 APP5-00481 APP5-00481 11 APP5-00482 APP5-00482 Thus, how to set the excel VB code in order to give the correct result that can be applied for both month1 & month2, i.e it should be as follow : - Month 1 Month 2 A B A B 1 GLP5-00652 2,000.00 GLP5-00652 2,000.00 2 GLP5-00654 3,350.00 GLP5-00654 3,350.00 3 GLP5-00655 1,450.00 GLP5-00655 1,450.00 4 APP5-00312 906.00 APP5-00312 906.00 5 GLP5-01173 - GLP5-01173 453.00 6 APP5-00477 - APP5-00477 21.00 7 GLP5-01077 - GLP5-01077 - 8 GLP5-01087 - GLP5-01087 - 9 APP5-00480 - APP5-00480 - 10 APP5-00481 - APP5-00481 - 11 APP5-00482 - APP5-00482 - Please help. Thanks in advance Regards Len |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
AutoFillDown
Len,
If I have understood correctly, will this do what you want? Set rng = Range(Cells(Activecell.row, 1), Cells(Activecell.row 1).End(xlDown) rng.Offset(0, 1).Formula = Cells(ActiveCell.row, 2).Formula HTH "Len" wrote: Hi, I've a problem to auto fill down the data from active cell ( say B5 in month1, B7 in month2 ) in column B if auto fill down function is to depend on the availability of column A data The active cell is used because the data is exported that can be placed in any cell of column B If I were to use the following codes in month1, it will give the correct result in month 1 but not in month 2 because it defined the obsolute cell reference, ie cell (5,1)& (5,2) Dim rng As Range Set rng = Range(Cells(5, 1), Cells(5, 1).End(xlDown) rng.Offset(0, 1).Formula = Cells(5, 2).Formula e.g. Month 1 Month 2 A B A B 1 GLP5-00652 2,000.00 GLP5-00652 2,000.00 2 GLP5-00654 3,350.00 GLP5-00654 3,350.00 3 GLP5-00655 1,450.00 GLP5-00655 1,450.00 4 APP5-00312 906.00 APP5-00312 906.00 5 GLP5-01173 - GLP5-01173 453.00 6 APP5-00477 APP5-00477 21.00 7 GLP5-01077 GLP5-01077 - 8 GLP5-01087 GLP5-01087 9 APP5-00480 APP5-00480 10 APP5-00481 APP5-00481 11 APP5-00482 APP5-00482 Thus, how to set the excel VB code in order to give the correct result that can be applied for both month1 & month2, i.e it should be as follow : - Month 1 Month 2 A B A B 1 GLP5-00652 2,000.00 GLP5-00652 2,000.00 2 GLP5-00654 3,350.00 GLP5-00654 3,350.00 3 GLP5-00655 1,450.00 GLP5-00655 1,450.00 4 APP5-00312 906.00 APP5-00312 906.00 5 GLP5-01173 - GLP5-01173 453.00 6 APP5-00477 - APP5-00477 21.00 7 GLP5-01077 - GLP5-01077 - 8 GLP5-01087 - GLP5-01087 - 9 APP5-00480 - APP5-00480 - 10 APP5-00481 - APP5-00481 - 11 APP5-00482 - APP5-00482 - Please help. Thanks in advance Regards Len |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
AutoFillDown
Hi,
Thanks, it works Regards Len Toppers wrote: Len, If I have understood correctly, will this do what you want? Set rng = Range(Cells(Activecell.row, 1), Cells(Activecell.row 1).End(xlDown) rng.Offset(0, 1).Formula = Cells(ActiveCell.row, 2).Formula HTH "Len" wrote: Hi, I've a problem to auto fill down the data from active cell ( say B5 in month1, B7 in month2 ) in column B if auto fill down function is to depend on the availability of column A data The active cell is used because the data is exported that can be placed in any cell of column B If I were to use the following codes in month1, it will give the correct result in month 1 but not in month 2 because it defined the obsolute cell reference, ie cell (5,1)& (5,2) Dim rng As Range Set rng = Range(Cells(5, 1), Cells(5, 1).End(xlDown) rng.Offset(0, 1).Formula = Cells(5, 2).Formula e.g. Month 1 Month 2 A B A B 1 GLP5-00652 2,000.00 GLP5-00652 2,000.00 2 GLP5-00654 3,350.00 GLP5-00654 3,350.00 3 GLP5-00655 1,450.00 GLP5-00655 1,450.00 4 APP5-00312 906.00 APP5-00312 906.00 5 GLP5-01173 - GLP5-01173 453.00 6 APP5-00477 APP5-00477 21.00 7 GLP5-01077 GLP5-01077 - 8 GLP5-01087 GLP5-01087 9 APP5-00480 APP5-00480 10 APP5-00481 APP5-00481 11 APP5-00482 APP5-00482 Thus, how to set the excel VB code in order to give the correct result that can be applied for both month1 & month2, i.e it should be as follow : - Month 1 Month 2 A B A B 1 GLP5-00652 2,000.00 GLP5-00652 2,000.00 2 GLP5-00654 3,350.00 GLP5-00654 3,350.00 3 GLP5-00655 1,450.00 GLP5-00655 1,450.00 4 APP5-00312 906.00 APP5-00312 906.00 5 GLP5-01173 - GLP5-01173 453.00 6 APP5-00477 - APP5-00477 21.00 7 GLP5-01077 - GLP5-01077 - 8 GLP5-01087 - GLP5-01087 - 9 APP5-00480 - APP5-00480 - 10 APP5-00481 - APP5-00481 - 11 APP5-00482 - APP5-00482 - Please help. Thanks in advance Regards Len |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|