View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Zoltar54 Zoltar54 is offline
external usenet poster
 
Posts: 8
Default Controling Excel using Word VBA

Asked and answered. I was just about to post a question about that!

Thanks very much, i'll let you know how it turns put.

Z

"Bernie Deitrick" wrote:

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