Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default variable in object name

I have checkboxes with names from checkbox1 to checkbox20
if I try
sub whatever()
for i=1 to 20
if checkbox(i).value=true then
do sumething
end if
next i
end sub
I get error message that sub or function not defined. How to fix that?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default variable in object name

sub whatever()
for i=1 to 20
if Activesheet.OleObjects("checkbox" & i).value=true then
do sumething
end if
next i
end sub

would be an example for a checkbox from the control toolbox toolbar where
the checkboxes have names like checkbox1 to checkbox20. You haven't said
where it is from or where it is located.

--
Regards,
Tom Ogilvy

"kaptenn" wrote in message
...
I have checkboxes with names from checkbox1 to checkbox20
if I try
sub whatever()
for i=1 to 20
if checkbox(i).value=true then
do sumething
end if
next i
end sub
I get error message that sub or function not defined. How to fix that?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default variable in object name

These checkboxes are located in userform

"Tom Ogilvy" wrote:

sub whatever()
for i=1 to 20
if Activesheet.OleObjects("checkbox" & i).value=true then
do sumething
end if
next i
end sub

would be an example for a checkbox from the control toolbox toolbar where
the checkboxes have names like checkbox1 to checkbox20. You haven't said
where it is from or where it is located.

--
Regards,
Tom Ogilvy

"kaptenn" wrote in message
...
I have checkboxes with names from checkbox1 to checkbox20
if I try
sub whatever()
for i=1 to 20
if checkbox(i).value=true then
do sumething
end if
next i
end sub
I get error message that sub or function not defined. How to fix that?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default variable in object name

sub whatever()
for i=1 to 20
if Userform1.Controls("checkbox" & i).value=true then
do sumething
end if
next i
end sub

--
Regards,
Tom Ogilvy

"kaptenn" wrote in message
...
These checkboxes are located in userform

"Tom Ogilvy" wrote:

sub whatever()
for i=1 to 20
if Activesheet.OleObjects("checkbox" & i).value=true then
do sumething
end if
next i
end sub

would be an example for a checkbox from the control toolbox toolbar

where
the checkboxes have names like checkbox1 to checkbox20. You haven't

said
where it is from or where it is located.

--
Regards,
Tom Ogilvy

"kaptenn" wrote in message
...
I have checkboxes with names from checkbox1 to checkbox20
if I try
sub whatever()
for i=1 to 20
if checkbox(i).value=true then
do sumething
end if
next i
end sub
I get error message that sub or function not defined. How to fix that?






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default variable in object name

Thanks a lot. And my task continues :)

"Tom Ogilvy" wrote:

sub whatever()
for i=1 to 20
if Userform1.Controls("checkbox" & i).value=true then
do sumething
end if
next i
end sub

--
Regards,
Tom Ogilvy

"kaptenn" wrote in message
...
These checkboxes are located in userform

"Tom Ogilvy" wrote:

sub whatever()
for i=1 to 20
if Activesheet.OleObjects("checkbox" & i).value=true then
do sumething
end if
next i
end sub

would be an example for a checkbox from the control toolbox toolbar

where
the checkboxes have names like checkbox1 to checkbox20. You haven't

said
where it is from or where it is located.

--
Regards,
Tom Ogilvy

"kaptenn" wrote in message
...
I have checkboxes with names from checkbox1 to checkbox20
if I try
sub whatever()
for i=1 to 20
if checkbox(i).value=true then
do sumething
end if
next i
end sub
I get error message that sub or function not defined. How to fix that?








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
Runtime Error '91' Object variable or With block variable not set Alec Coliver Excel Discussion (Misc queries) 2 October 24th 09 02:29 PM
Object Variable Not Set Error on Selection object Jean Excel Worksheet Functions 3 July 24th 06 06:45 PM
Run-time error '91': "Object variable or With block variable not set Mike[_92_] Excel Programming 2 December 30th 04 10:59 AM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM
Pivot Table - Object variable or with block variable not set? George Nicholson[_2_] Excel Programming 1 April 16th 04 09:12 PM


All times are GMT +1. The time now is 01:30 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"