Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2008

Tip: Looking for answers? Try searching our database.

Object Name and For Loop

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gojavid - 28 Jan 2008 15:54 GMT
Good morning,
   It has probably been asked before and it is definitely a
beginner's question, but any response it greatly appreciated.

I have a series of label boxes on a form and I need to set the caption
on each of them equal to a cell in the spreadsheet.  I know how to do
this the long way:

label1.caption = cells(1,1)

but I was wondering if I could use a for loop and make this process a
little easier for the future... something like:

for i = 1 to 14
dim lbltest as object
   set lbltest = "userform1.label" & i
lbltest.caption = cell(i +1,1)
next

any ideas?
Gojavid - 28 Jan 2008 16:04 GMT
I found some material on this subject from another newsgroup... Thanks
anyways:

dim txtbx as control
set txtbx = userform.control("txtbxHZ_" & i)
with userform
   for i = 1 to 10
       sheets("name").Range("name") = txtbx.value
   next i
end with
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.