Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Counting Controls in a sheet

Hi

I want to know the number of textboxes that is placed on a sheet, and their names. How can i get the data from each control at runtime as i don't know how many controls are placed on that particular sheet?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Counting Controls in a sheet

form the drawing toolbar

msgbox activesheet.Textboxes.count

for control toolbox toolbar textboxes

Dim cnt as long, obj as OleObject
cnt = 0
for each obj in Activesheet.OleObjects
if type of obj.Object is MSforms.Textbox then
cnt = cnt + 1
end if
Next
msgbox cnt

--
Regards,
Tom Ogilvy

"Vikram Kohli" wrote in message
...
Hi,

I want to know the number of textboxes that is placed on a sheet, and

their names. How can i get the data from each control at runtime as i don't
know how many controls are placed on that particular sheet?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Counting Controls in a sheet

Hi Vikram,

This should help

Dim i As Long
Dim OLEObject As Object

For Each OLEObject In ActiveSheet.OLEObjects
If TypeOf OLEObject.Object Is MSForms.TextBox Then
i = i + 1
End If
Next OLEObject
MsgBox i

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Vikram Kohli" wrote in message
...
Hi,

I want to know the number of textboxes that is placed on a sheet, and

their names. How can i get the data from each control at runtime as i don't
know how many controls are placed on that particular sheet?

Thanks



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting data from sheet to sheet Help with cell function[_2_] Excel Discussion (Misc queries) 3 September 30th 09 07:19 PM
How do I split form controls in a sheet in excel? Desperateticha Excel Discussion (Misc queries) 1 November 9th 07 01:57 PM
how to activate controls in protected sheet Novice Excel Worksheet Functions 2 February 1st 06 11:42 PM
ActiveX Controls vs Form Controls Alex Excel Discussion (Misc queries) 1 January 11th 06 08:46 AM
Need more than 1208 controls per sheet mowali Excel Discussion (Misc queries) 1 December 7th 05 03:43 PM


All times are GMT +1. The time now is 11:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"