Excel Workbook | |||
---|---|---|---|
A | |||
1 | a | ||
2 | a | ||
3 | b | ||
4 | b | ||
5 | cc | ||
6 | cc | ||
7 | cc | ||
8 | cc | ||
9 | d | ||
10 | ee | ||
11 | |||
Sheet1 |
Excel Workbook | |||
---|---|---|---|
A | |||
1 | a | ||
2 | a | ||
3 | |||
4 | |||
5 | b | ||
6 | b | ||
7 | |||
8 | |||
9 | cc | ||
10 | cc | ||
11 | cc | ||
12 | cc | ||
13 | |||
14 | |||
15 | d | ||
16 | |||
17 | |||
18 | ee | ||
19 | |||
Sheet1 |
Option Explicit
Sub InsertTwo()
' hiker95, 03/31/2011
' http://www.mrexcel.com/forum/showthread.php?t=540316
Dim LR As Long, a As Long
Application.ScreenUpdating = False
LR = Cells(Rows.Count, 1).End(xlUp).Row
For a = LR To 2 Step -1
If Cells(a, 1) <> Cells(a - 1, 1) Then Rows(a).Resize(2).Insert
Next a
Application.ScreenUpdating = True
End Sub
Excel Workbook | ||||||||
---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | |||
1 | Customer ID | Name | Item ID | Item Description | Qty | Amount | ||
2 | A&R 01 | ABC | 2001000001006 | Star Copy, Copy Paper 8.5 x 14 | 2,400.00 | 64,770.00 | ||
3 | A1OTL | DEF | 2001000001006 | Star Copy, Copy Paper 8.5 x 14 | 210.00 | 5,667.38 | ||
4 | A&R 01 | GHI | 2001000001009 | Star Copy, Copy Paper A4 | 3,760.00 | 14,250.40 | ||
5 | ACADEMY 01 | JKL | 60-INDX-EW-000-0805 | INDEX CARDS 8 X 5 100/PACK | 3.00 | 37.50 | ||
6 | A.S 01 | MNO | 61-GRAB-EW-000-001 | GRAPH BOOK SPIRAL 40LVS | 100.00 | 400.00 | ||
7 | ACADEMY 01 | PQR | 61-PADP-EW-040-8511 | PADS 8.5 X 11 WHITE PERFORATED | 12.00 | 54.00 | ||
8 | A.S 01 | STU | 61-SKTP-EW-000-1014 | SKETCH PAD 10 X 14 | 80.00 | 300.00 | ||
9 | ACADEMY 01 | VW | 6-RECB-EW-100-0604 | Receipt Books 2pt 6 X 4 100'S | 2.00 | 19.00 | ||
10 | ACADEMY 01 | XY | 8-CLIP-PPR-003 | Ezy Clip Paper Clip Medium | 3.00 | 4.35 | ||
11 | ACADEMY 01 | Z | 8-ENVLOPE-MAN-007 | Manilla envelopes 12 x 15.5 | 100.00 | 110.00 | ||
12 | ACADEMY 01 | AZ | 8-ENVLOPE-WHT-009 | White window envelopes 4 1/8 x | 100.00 | 18.00 | ||
Sheet1 |
Excel Workbook | ||||||||
---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | |||
1 | Customer ID | Name | Item ID | Item Description | Qty | Amount | ||
2 | A&R 01 | ABC | 2001000001006 | Star Copy, Copy Paper 8.5 x 14 | 2,400.00 | 64,770.00 | ||
3 | A1OTL | DEF | 2001000001006 | Star Copy, Copy Paper 8.5 x 14 | 210.00 | 5,667.38 | ||
4 | 70,437.38 | |||||||
5 | ||||||||
6 | A&R 01 | GHI | 2001000001009 | Star Copy, Copy Paper A4 | 3,760.00 | 14,250.40 | ||
7 | 14,250.40 | |||||||
8 | ||||||||
9 | ACADEMY 01 | JKL | 60-INDX-EW-000-0805 | INDEX CARDS 8 X 5 100/PACK | 3.00 | 37.50 | ||
10 | 37.50 | |||||||
11 | ||||||||
12 | A.S 01 | MNO | 61-GRAB-EW-000-001 | GRAPH BOOK SPIRAL 40LVS | 100.00 | 400.00 | ||
13 | 400.00 | |||||||
14 | ||||||||
15 | ACADEMY 01 | PQR | 61-PADP-EW-040-8511 | PADS 8.5 X 11 WHITE PERFORATED | 12.00 | 54.00 | ||
16 | 54.00 | |||||||
17 | ||||||||
18 | A.S 01 | STU | 61-SKTP-EW-000-1014 | SKETCH PAD 10 X 14 | 80.00 | 300.00 | ||
19 | 300.00 | |||||||
20 | ||||||||
21 | ACADEMY 01 | VW | 6-RECB-EW-100-0604 | Receipt Books 2pt 6 X 4 100'S | 2.00 | 19.00 | ||
22 | 19.00 | |||||||
23 | ||||||||
24 | ACADEMY 01 | XY | 8-CLIP-PPR-003 | Ezy Clip Paper Clip Medium | 3.00 | 4.35 | ||
25 | 4.35 | |||||||
26 | ||||||||
27 | ACADEMY 01 | Z | 8-ENVLOPE-MAN-007 | Manilla envelopes 12 x 15.5 | 100.00 | 110.00 | ||
28 | 110.00 | |||||||
29 | ||||||||
30 | ACADEMY 01 | AZ | 8-ENVLOPE-WHT-009 | White window envelopes 4 1/8 x | 100.00 | 18.00 | ||
31 | ACADEMY 01 | AZ | 8-ENVLOPE-WHT-009 | White window envelopes 4 1/8 x | 100.00 | 18.00 | ||
32 | 36.00 | |||||||
Sheet1 |
Excel Workbook | ||||||||
---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | |||
1 | Customer ID | Name | Item ID | Item Description | Qty | Amount | ||
2 | A&R 01 | ABC | 2001000001006 | Star Copy, Copy Paper 8.5 x 14 | 2,400.00 | 64,770.00 | ||
3 | A1OTL | DEF | 2001000001006 | Star Copy, Copy Paper 8.5 x 14 | 210 | 5,667.38 | ||
4 | A&R 01 | GHI | 2001000001009 | Star Copy, Copy Paper A4 | 3,760.00 | 14,250.40 | ||
5 | ACADEMY *01 | JKL | 60-INDX-EW-000-0805 | INDEX CARDS 8 X 5 100/PACK | 3 | 37.5 | ||
6 | A.S 01 | MNO | 61-GRAB-EW-000-001 | GRAPH BOOK SPIRAL 40LVS | 100 | 400 | ||
7 | ACADEMY *01 | PQR | 61-PADP-EW-040-8511 | PADS 8.5 X 11 WHITE PERFORATED | 12 | 54 | ||
8 | A.S 01 | STU | 61-SKTP-EW-000-1014 | SKETCH PAD 10 X 14 | 80 | 300 | ||
9 | ACADEMY *01 | VW | 6-RECB-EW-100-0604 | Receipt Books 2pt 6 X 4 100'S | 2 | 19 | ||
10 | ACADEMY *01 | XY | 8-CLIP-PPR-003 | Ezy Clip Paper Clip Medium | 3 | 4.35 | ||
11 | ACADEMY *01 | Z | 8-ENVLOPE-MAN-007 | Manilla envelopes 12 x 15.5 | 100 | 110 | ||
12 | ACADEMY *01 | AZ | 8-ENVLOPE-WHT-009 | White window envelopes 4 1/8 x | 100 | 18 | ||
13 | ||||||||
Sheet1 |
Excel Workbook | ||||||||
---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | |||
1 | Customer ID | Name | Item ID | Item Description | Qty | Amount | ||
2 | A&R 01 | ABC | 2001000001006 | Star Copy, Copy Paper 8.5 x 14 | 2,400.00 | 64,770.00 | ||
3 | A1OTL | DEF | 2001000001006 | Star Copy, Copy Paper 8.5 x 14 | 210 | 5,667.38 | ||
4 | 70,437.38 | |||||||
5 | ||||||||
6 | A&R 01 | GHI | 2001000001009 | Star Copy, Copy Paper A4 | 3,760.00 | 14,250.40 | ||
7 | 14,250.40 | |||||||
8 | ||||||||
9 | ACADEMY *01 | JKL | 60-INDX-EW-000-0805 | INDEX CARDS 8 X 5 100/PACK | 3 | 37.5 | ||
10 | 37.50 | |||||||
11 | ||||||||
12 | A.S 01 | MNO | 61-GRAB-EW-000-001 | GRAPH BOOK SPIRAL 40LVS | 100 | 400 | ||
13 | 400.00 | |||||||
14 | ||||||||
15 | ACADEMY *01 | PQR | 61-PADP-EW-040-8511 | PADS 8.5 X 11 WHITE PERFORATED | 12 | 54 | ||
16 | 54.00 | |||||||
17 | ||||||||
18 | A.S 01 | STU | 61-SKTP-EW-000-1014 | SKETCH PAD 10 X 14 | 80 | 300 | ||
19 | 300.00 | |||||||
20 | ||||||||
21 | ACADEMY *01 | VW | 6-RECB-EW-100-0604 | Receipt Books 2pt 6 X 4 100'S | 2 | 19 | ||
22 | 19.00 | |||||||
23 | ||||||||
24 | ACADEMY *01 | XY | 8-CLIP-PPR-003 | Ezy Clip Paper Clip Medium | 3 | 4.35 | ||
25 | 4.35 | |||||||
26 | ||||||||
27 | ACADEMY *01 | Z | 8-ENVLOPE-MAN-007 | Manilla envelopes 12 x 15.5 | 100 | 110 | ||
28 | 110.00 | |||||||
29 | ||||||||
30 | ACADEMY *01 | AZ | 8-ENVLOPE-WHT-009 | White window envelopes 4 1/8 x | 100 | 18 | ||
31 | 18.00 | |||||||
32 | ||||||||
Sheet1 |
Option Explicit
Sub InsertTwoAndSum()
' hiker95, 03/31/2011
' http://www.mrexcel.com/forum/showthread.php?t=540316
Dim LR As Long, a As Long
Dim FArea As Range, SR As Long, ER As Long
Application.ScreenUpdating = False
LR = Cells(Rows.Count, 3).End(xlUp).Row
For a = LR To 3 Step -1
If Cells(a, 3) <> Cells(a - 1, 3) Then Rows(a).Resize(2).Insert
Next a
For Each FArea In Range("F2", Range("F" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeConstants).Areas
With FArea
SR = .Row
ER = SR + .Rows.Count - 1
With Range("F" & ER + 1)
.Value = "=SUM(F" & SR & ":F" & ER & ")"
.Font.Bold = True
.NumberFormat = "#,##0.00"
End With
End With
Next FArea
Application.ScreenUpdating = True
End Sub
Option Explicit
Sub InsertTwoAndSum()
' hiker95, 03/31/2011
' http://www.mrexcel.com/forum/showthread.php?t=540316
Dim LR As Long, a As Long
Dim FArea As Range, SR As Long, ER As Long
Application.ScreenUpdating = False
LR = Cells(Rows.Count, 3).End(xlUp).Row
For a = LR To 3 Step -1
If Cells(a, 3) <> Cells(a - 1, 3) Then Rows(a).Resize(2).Insert
Next a
For Each FArea In Range("F2", Range("F" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeConstants).Areas
With FArea
SR = .Row
ER = SR + .Rows.Count - 1
With Range("F" & ER + 1)
.Value = "=SUM(F" & SR & ":F" & ER & ")"
.Font.Bold = True
.NumberFormat = "#,##0.00"
.Interior.Color = 65535
End With
End With
Next FArea
Application.ScreenUpdating = True
End Sub