+ Reply to Thread
Results 1 to 3 of 3

Form Object Names and VBA Code [Excel 14, VBA Only]

  1. #1
    Forum Contributor
    Join Date
    03-22-2012
    Location
    OR, USA
    MS-Off Ver
    Excel 14/2010
    Posts
    273

    Form Object Names and VBA Code [Excel 14, VBA Only]

    I have a form that contains 10 text boxes labeled CPTCodeBox_x (where x = 1 to 10). On form load I want to set the values to 0. Instead of using 10 lines of code and setting each value to zero I am trying to use a For Next Loop with an embedded with/end with. However, I am getting an error that reads "WITH OBJECT MUST BE USER-DEFINED TYPE, OBJECT, OR VARIANT"

    Code:
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Form Object Names and VBA Code [Excel 14, VBA Only]

    This should work
    Please Login or Register  to view this content.
    of course you can also set the value during design, not during the load/initialize
    If you are pleased with a member's answer then use the Star icon to rate it.

  3. #3
    Forum Contributor
    Join Date
    03-22-2012
    Location
    OR, USA
    MS-Off Ver
    Excel 14/2010
    Posts
    273

    Re: Form Object Names and VBA Code [Excel 14, VBA Only]

    Gracias. I will be using the code elsewhere as well. I just could not figure out how to code it so I could use an array to change the values. Thank you again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 01-09-2014, 11:27 PM
  2. [SOLVED] Generic Current Object Reference Inside that Object's Code
    By Aegwyn11 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2012, 01:23 PM
  3. VBA code to list names of controls on user form?
    By Peter in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-31-2006, 04:40 AM
  4. How do I resize a check box form object in Excel?
    By bpoole in forum Excel General
    Replies: 1
    Last Post: 05-11-2006, 01:40 PM
  5. [SOLVED] Can you paste file *NAMES* into Excel to form a database of them?
    By Nat Maxwell in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-23-2005, 05:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1