View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Controling Excel using Word VBA

Z,

D'Oh! <Head smack

You'll need to correct my errors:

xlSht.Cells(xlSht.Rows.Count, xlCell.Column).....

Since xlCell is nothing, this will blow up....

Instead, put this declaration at the top
Dim mySRange As Excel.Range


Then use this three times, as in the last example:

myValue = ComboBox1.Value
' set search range for ComboBox1 Values
Set mySRange = xlSht.Range("A:A")
Set xlCell = mySRange.Find(myValue)
If xlCell Is Nothing Then ' add the value to the set at the bottom
xlSht.Cells(xlSht.Rows.Count, mySRange.Column).End(xlUp)(2).Value = myValue
End If

etc...

Sorry about that...

Bernie
MS Excel MVP


"Zoltar54" wrote in message
...
Bernie,

Very much appreciated. I will give it a go and see if it works.

Thanks agaian,

Z