Results 1 to 4 of 4

Is there a way to rewrite this code for a UserForm in loop form?

Threaded View

  1. #1
    Registered User
    Join Date
    07-29-2013
    Location
    California, United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    Is there a way to rewrite this code for a UserForm in loop form?

    I don't know how to rewrite this in loop form because the numbers are attached to the word i.e. "textbox1" instead of textbox(1). I know how to loop through the cells, but not through the different textboxes.

    With Worksheets("Sheet1")
    
        .Cells(20, 1) = TextBox1.Value
        .Cells(21, 1) = TextBox2.Value
        .Cells(22, 1) = TextBox3.Value
        .Cells(23, 1) = TextBox4.Value
        .Cells(24, 1) = TextBox5.Value
        .Cells(25, 1) = TextBox6.Value
        .Cells(26, 1) = TextBox7.Value
        .Cells(27, 1) = TextBox8.Value
        
        .Cells(20, 2) = ListBox1.Value
        .Cells(21, 2) = ListBox2.Value
        .Cells(22, 2) = ListBox3.Value
        .Cells(23, 2) = ListBox4.Value
        .Cells(24, 2) = ListBox5.Value
        .Cells(25, 2) = ListBox6.Value
        .Cells(26, 2) = ListBox7.Value
        .Cells(27, 2) = ListBox8.Value
    
    End With
    Last edited by bananajelly; 08-05-2014 at 05:24 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Rewrite existing code to include date in filename
    By MissaLissa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-02-2013, 01:03 PM
  2. [SOLVED] Looking for help with speeding up or rewrite on vba code.
    By ukchris74 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-16-2013, 01:54 PM
  3. [SOLVED] Outlook 2010: Rewrite VBA Code
    By Cansa in forum Outlook Formatting & Functions
    Replies: 3
    Last Post: 10-12-2012, 12:25 PM
  4. Need to rewrite protect code so that it will work with a hidden sheet.
    By mrgillus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-28-2009, 08:17 PM
  5. how would I rewrite this userform-to-worksheet procedure as a loop?
    By durandal05 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-21-2008, 05:00 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