View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Nigel RS[_2_] Nigel RS[_2_] is offline
external usenet poster
 
Posts: 80
Default Identifying Userform Control Type

Thank You

I used TypeName(ctr) as the assignment value

Cheers

"Peter T" wrote:

dim ctr as control
for each ctr in myform.controls
n = n + 1
sType = typename(ctr)
cells(n,1) = sType
cells(n,2) = ctr.name

select case sType
case "CommandButton": 'code
' etc
end select
next

(not tested)

Regards,
Peter T

"Nigel RS" wrote in message
...
Hi All
How can I identifiy the type of control (command button, testbox etc.) on

a
userform?

I wish to do two things...

1. Store the control type in a sheet cell
2. Use a conditional depending on the control type

Thanks