Hello,
alvinwlh sent me this VBA which is the solution to this other thread:
http://www.mrexcel.com/forum/showth...s-with-Parts&p=3196643&viewfull=1#post3196643
The code is as follows:
</code></code>
When I run it I get "Runtime Error '6': Overflow". Is there anyone who might know why this is happening? Thanks!
alvinwlh sent me this VBA which is the solution to this other thread:
http://www.mrexcel.com/forum/showth...s-with-Parts&p=3196643&viewfull=1#post3196643
The code is as follows:
Rich (BB code):
<code><code>Sub arrangeA_B()
Dim last_row As Integer
Dim my_range As Range
Dim rag, c As Range
Dim temp
last_row = Range("B" & Rows.count).End(xlUp).Row
For x = 1 To last_row
Set c = Range("A:A").Find(Range("B" & x).Value, LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
If c.Row <> x And Range("B" & x).Value <> "" Then
If c.Offset(0, 1).Value = Range("B" & x).Value Then
R = MsgBox("Duplication " & Range("B" & x).Value, vbOKOnly)
Exit Sub
End If
temp = c.Offset(0, 1).Value
Temp2 = c.offset(0,2).value
c.Offset(0, 1).Value = Range("B" & x).Value
c.Offset(0,2).Value = Range("C" & x).Value
Range("B" & x).Value = temp
Range("C" & x).Value = temp2
x = x - 1
End If
Else
Range("B" & Range("B" & Rows.count).End(xlUp).Row + 1).Value = Range("B" & x).Value
Range("C" & Range("C" & Rows.count).End(xlUp).Row + 1).Value = Range("C" & x).Value
Range("B" & x).ClearContents
Range("C" & x).clearcontents
End If
Next
End Sub
When I run it I get "Runtime Error '6': Overflow". Is there anyone who might know why this is happening? Thanks!