Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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
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
Script to insert Row Jeremy Excel Discussion (Misc queries) 2 April 19th 10 02:39 PM
Need VBA script to auto-insert value upon row insert Phil Excel Worksheet Functions 4 May 6th 08 02:41 PM
Insert a key function in VBA script Bowes813 Excel Programming 3 May 26th 05 11:27 PM
Script to insert the next Friday Mark Langendoerfer Excel Programming 1 April 12th 05 09:57 PM
insert excel vb script bt707[_6_] Excel Programming 1 October 18th 03 03:43 PM


All times are GMT +1. The time now is 08:45 AM.

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"