Hello all
thanks for this great forum, I hope someone can help me. I have no macro experience but would like to do the following.
I have a set of data in columns A-F and a set of data in columns H-L
I wish to align H-L with A-F using A as the ref and L as the column to guide H-L.
I want to update A-F weekly. H-L will always be the same.
When a row in H-L is not matched to A-F then I want it pushed to the bottom of H-L.
The file I want to align is available in the link below as its to big to upload and any help is very welcome.
I do have some code but it gets stuck with a Run=time error 13 Type mismatch at the bold line.
The code is below. I hope I have done it right..
Many thanks,
Kevin
https://app.box.com/s/oaddyoumjakr7603evi9
thanks for this great forum, I hope someone can help me. I have no macro experience but would like to do the following.
I have a set of data in columns A-F and a set of data in columns H-L
I wish to align H-L with A-F using A as the ref and L as the column to guide H-L.
I want to update A-F weekly. H-L will always be the same.
When a row in H-L is not matched to A-F then I want it pushed to the bottom of H-L.
The file I want to align is available in the link below as its to big to upload and any help is very welcome.
I do have some code but it gets stuck with a Run=time error 13 Type mismatch at the bold line.
The code is below. I hope I have done it right..
Code:
Sub AlignAF_GL()
' hiker95, 06/03/2014, ME781635
Dim o As Variant, j As Long
Dim lra As Long, lri As Long
Dim c As Range, irng As Range
Application.ScreenUpdating = False
With Sheets("Sheet1")
lra = .Cells(Rows.Count, "A").End(xlUp).Row
lri = .Cells(Rows.Count, "I").End(xlUp).Row
With .Range("I2:I" & lri)
.Value = Evaluate("IF(ISTEXT(" & .Address & "),TRIM(" & .Address & "),REPT(" & .Address & ",1))")
End With
ReDim o(1 To lri - 1, 1 To 6)
For Each c In .Range("A2:A" & lra)
Set irng = .Columns(9).Find(c, LookAt:=xlWhole)
If Not irng Is Nothing Then
j = j + 1
o(j, 1) = .Cells(irng.Row, 7)
o(j, 2) = .Cells(irng.Row, 8)
o(j, 3) = .Cells(irng.Row, 9)
o(j, 4) = .Cells(irng.Row, 10)
o(j, 5) = .Cells(irng.Row, 11)
o(j, 6) = .Cells(irng.Row, 12)
.Cells(irng.Row, 9).ClearContents
Set irng = Nothing
End If
Next c
For Each c In .Range("I2:I" & lri)
If c <> "" Then
j = j + 1
o(j, 1) = .Cells(c.Row, 7)
o(j, 2) = .Cells(c.Row, 8)
o(j, 3) = .Cells(c.Row, 9)
o(j, 4) = .Cells(c.Row, 10)
o(j, 5) = .Cells(c.Row, 11)
o(j, 6) = .Cells(c.Row, 12)
End If
Next c
.Range("G2:L" & lri).ClearContents
.Range("G2").Resize(UBound(o, 1), UBound(o, 2)) = o
End With
Application.ScreenUpdating = True
End Sub
Many thanks,
Kevin
https://app.box.com/s/oaddyoumjakr7603evi9