Combining like data

A

ashton

Hello,

I came across this bit of code (below). The bit of code successfully groups
cells of data if they are of the same value.

For example:
1|2
2|4
3|6
4|8
5|
6|
7|
8|

Becomes:
1|
2|2
3|
4|4
5|
6|6
7|
8|8

What I need it to do is move an additional cell, example:

Change

1|2|A
2|4|B
3|
4|

To
1|
2|2|A
3|
4|4|B

I thought that if I simply put in a call to the additional column it would
work.
So I changed:
Cells(i, 5).Resize(1, 3).Insert shift:=xlDown

to this
Cells(i, 5).Resize(1, 3).Insert shift:=xlDown
Cells(i, 6).Resize(1, 3).Insert shift:=xlDown

To try and move 2 columns... this simply did not work. It must be a simple
way, is there a way to make column F (in the code below) move when column E
moves?

Once again, any help is appreciated


Public Sub BumpAndFill()
Dim i As Long
With Application
.ScreenUpdating = False
.Calculation = xlManual
End With
i = 1
Do Until IsEmpty(Cells(i, 1).Value)
Application.StatusBar = i
Do Until Cells(i, 5).Value = Cells(i, 1).Value
Cells(i, 5).Resize(1, 3).Insert shift:=xlDown
i = i + 1
Loop
i = i + 1
Loop
With Application
.Calculation = xlAutomatic
.StatusBar = False
.ScreenUpdating = True
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top