View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Janis Janis is offline
external usenet poster
 
Posts: 360
Default error message 438 or type mismatch

I get an error message 438 if I use the 2nd intLastRow line, I get a type
mismatch 13 if I use the 1st intLastJRow line. In either case it doesnt'
compile. I was thinking it was something wrong with the setting of the ws
variable but I dont' know which intlastrow it should be. I only want all the
names in row "A" to be in the combo box list. I'm having trouble with
setting the rng and ws variables.
tnx,

Private Sub UserForm_Initialize()

Dim intLastRow As Integer
Dim ws As Object
Dim c As Range
Dim rng As Range
Set ws = ThisWorkbook.Worksheets("patients")


'intLastRow = ws.SpecialCells(xlCellTypeLastCell).Row
intLastRow = Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious)



Set rng = ws.Range("A1:A" & intLastRow)
ComboBox2.Clear
For Each c In Worksheets("patients").rng
ComboBox2.AddItem c.Value
Next c

End Sub