FrankMcNally
Board Regular
- Joined
- Nov 14, 2014
- Messages
- 71
Hello again,
I work on various worksheets which import data into columns A:N with various amounts of rows
I need a macro to go the sheet and insert two lines whenever values in column D change.
The macro must also sum column N at each blank line.
The following inserts the blank line(s) when needed but sum the entire column N
My Spreadsheet looks like this:
As you can see Column N is summed from N2:N6, but what I need is a sum of N2:N4 and one of N6
Anybody have any insight??
I work on various worksheets which import data into columns A:N with various amounts of rows
I need a macro to go the sheet and insert two lines whenever values in column D change.
The macro must also sum column N at each blank line.
The following inserts the blank line(s) when needed but sum the entire column N
Code:
Dim LastRow As Long LastRow = Range("A5000").End(xlUp).Row
Range("n" & LastRow + 1) = Application.WorksheetFunction.Sum(Range("n2:n" & LastRow))
Columns("N:N").Select
Columns("N:N").EntireColumn.AutoFit
Range("N" & LastRow + 1).Select
Selection.Font.Bold = True
My Spreadsheet looks like this:
REQ# Req Total Req count DO Product Curr Exchange rate SysDate Period INV Acct# DueDate PayeeLine1 Amount 00000202100351507C001 3076.18 00000003 35 4000000000 01 0001000000000000 2015/10/06 151607 215207370017 0 2015/09/09 John Doe $738.62 00000202100351507C001 3076.18 00000003 35 4000000000 01 0001000000000000 2015/10/06 151607 215207370018 0 2015/09/09 JanDoe $1,399.82 00000202100351507C001 3076.18 00000003 35 4000000000 01 0001000000000000 2015/10/06 151607 215207370020 0 2015/09/09 Steve Smith $937.74 00000602100521507C002 65 00000001 52 4000000000 01 0001000000000000 2015/10/06 151607 345205997837 0 2015/08/27 O Sue Smith $65.00 7.1234 $3,141.18
<tbody>
</tbody>
As you can see Column N is summed from N2:N6, but what I need is a sum of N2:N4 and one of N6
Anybody have any insight??