Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB Script to insert row and calculate a range
Sorry, I am new to this. Please forgive my ignorance.
I recorded a macro that sorts items first by class (ie.108 or 217 located in column F) and then by dollar amount (located in column S). There may be 10 items in a class. I need the script to locate the last occurance of the class number (Column F) on the sheet and then insert a row below. The script needs to sum the dollar amounts in the new row in Column S. I would appreciate any help I can get. ~Robert |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB Script to insert row and calculate a range
Dim LastRow As Long LastRow = Cells(Rows.Count, "F").End(xlUp).Row Cells(LastRow + 1, "S").FormulaR1C1 = "=SUM(R1C19:R[-1]C19)" -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "rlee1999" wrote in message ... Sorry, I am new to this. Please forgive my ignorance. I recorded a macro that sorts items first by class (ie.108 or 217 located in column F) and then by dollar amount (located in column S). There may be 10 items in a class. I need the script to locate the last occurance of the class number (Column F) on the sheet and then insert a row below. The script needs to sum the dollar amounts in the new row in Column S. I would appreciate any help I can get. ~Robert |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB Script to insert row and calculate a range
Thank you for your quick reply. I inserted this into my macro after the sort
and it did not act as expected. I have 22 different classes, I need a row insert after each class and to sum the total dollar amount for each class in the new row. As is Needs to be A B...F...............AI A B...F...............AI 125 216.70 125 216.70 125 760.93 125 760.93 125 119.36 125 119.36 124 361.33 1189.06 124 105.80 124 361.33 124 105.80 467.13 In my original post I stated as an example, that the dollar amounts to be summed were in Column S, which may have been an error on my part. The Dollar amounts are actually in Column AI. I hope you can help. Thank you, ~Robert "Bob Phillips" wrote: Dim LastRow As Long LastRow = Cells(Rows.Count, "F").End(xlUp).Row Cells(LastRow + 1, "S").FormulaR1C1 = "=SUM(R1C19:R[-1]C19)" -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "rlee1999" wrote in message ... Sorry, I am new to this. Please forgive my ignorance. I recorded a macro that sorts items first by class (ie.108 or 217 located in column F) and then by dollar amount (located in column S). There may be 10 items in a class. I need the script to locate the last occurance of the class number (Column F) on the sheet and then insert a row below. The script needs to sum the dollar amounts in the new row in Column S. I would appreciate any help I can get. ~Robert |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB Script to insert row and calculate a range
I presume that this has been superseded by your later post?
-- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "rlee1999" wrote in message ... Thank you for your quick reply. I inserted this into my macro after the sort and it did not act as expected. I have 22 different classes, I need a row insert after each class and to sum the total dollar amount for each class in the new row. As is Needs to be A B...F...............AI A B...F...............AI 125 216.70 125 216.70 125 760.93 125 760.93 125 119.36 125 119.36 124 361.33 1189.06 124 105.80 124 361.33 124 105.80 467.13 In my original post I stated as an example, that the dollar amounts to be summed were in Column S, which may have been an error on my part. The Dollar amounts are actually in Column AI. I hope you can help. Thank you, ~Robert "Bob Phillips" wrote: Dim LastRow As Long LastRow = Cells(Rows.Count, "F").End(xlUp).Row Cells(LastRow + 1, "S").FormulaR1C1 = "=SUM(R1C19:R[-1]C19)" -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "rlee1999" wrote in message ... Sorry, I am new to this. Please forgive my ignorance. I recorded a macro that sorts items first by class (ie.108 or 217 located in column F) and then by dollar amount (located in column S). There may be 10 items in a class. I need the script to locate the last occurance of the class number (Column F) on the sheet and then insert a row below. The script needs to sum the dollar amounts in the new row in Column S. I would appreciate any help I can get. ~Robert |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Script to insert Row | Excel Discussion (Misc queries) | |||
Need VBA script to auto-insert value upon row insert | Excel Worksheet Functions | |||
Insert a key function in VBA script | Excel Programming | |||
Script to insert the next Friday | Excel Programming | |||
insert excel vb script | Excel Programming |