Thread: find method?
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
CG Rosén CG Rosén is offline
external usenet poster
 
Posts: 74
Default find method?


Good Day again,

Many thanks for your advise. Have modified the code as below and it
works fine. Are little confused regarding line 1, the definition of the
range.
Tried this:
With ActiveSheet.Range("DG5:DG30") .This puts the values in cell
"DG31". Is this syntax a dead end?

Thanks again.

Brgds

CG Rosén

Private Sub CommandButton5_Click()
Dim c
With ActiveSheet.Range("DG5").CurrentRegion.Columns(1)

Set c = .Find(ComboBox1.Text, LookIn:=xlValues)
If c Is Nothing Then
.Cells(.Rows.Count + 1).Value = ComboBox1.Text
.Cells(.Rows.Count + 1).Offset(0, 1).Value = TextBox3.Text
Else
c.Offset(0, 1).Value = c.Offset(0, 1).Value + TextBox3.Text
End If
End With
End Sub