View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Script that automatically writes

Maybe this,

Right click the sheet tab, view code paste this in an run it

Sub stance()
Dim MyRangeA, MyrangeB, BigRange As Range
LastrowA = Cells(Rows.Count, "A").End(xlUp).Row
lastrowb = Cells(Rows.Count, "B").End(xlUp).Row
Set MyRangeA = Range("A1:A" & LastrowA)
Set MyrangeB = Range("B1:B" & lastrowb)
For Each a In MyRangeA
For Each b In MyrangeB
If a.Text = b.Text Then Exit For
If BigRange Is Nothing Then
Set BigRange = a
Else
Set BigRange = Union(BigRange, a)
End If
Next
Next
BigRange.Copy
Cells(lastrowb, 2).Offset(1, 0).PasteSpecial
End Sub

Does that work?
Mike

"dangerd" wrote:

Hi there,

I have a very specific requirement but poor vba knowledge.

Basically I am looking for a script that will look a all the strings
contained within a range, compare it with data in another range and,
if there is data missing, append the missing data at the end of the
second range.

So it will go a little like this:

1- XL looks at all the data in colum A
2- Data in column A is then compared to that in column B
3- Is there are any difference, missing data is appended to column B

Has anyone got any ideas?

THx

D