Thread: for each error
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default for each error

The same code works to populate another list box. Why am I getting this
error?


The difference is the "Option Explicit" statement which requires all
variables to be declared.

Try:

Option Explicit
Private Sub UserForm_Activate()
Dim cell As Range
For Each cell In Range("cpName")
If cell.Value < "" Then
lstMnemonic.AddItem cell.Value
End If
Next cell
End Sub



Regards,
KL