+ Reply to Thread
Results 1 to 3 of 3

counting between dynamic textboxes

Hybrid View

  1. #1
    Registered User
    Join Date
    07-25-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    22

    counting between dynamic textboxes

    In my userform I have dynamic text boxes. Each row consists of three text boxes. In each row I want to have a formula(for example: TextBox1 + TextBox2 = textbox 3) and a change-event if a change a value. The problem is that I don't now where and how to give that change-event, because the textboxes are dynamically added (and the number of textboxes is i). Hope that I made myself clear and somebody can help me

    mabulco

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: counting between dynamic textboxes

    Hello mabulco,

    You should post a copy of your workbook. It will answer a lot questions without having to ask them and you will get an answer much faster.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    07-25-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: counting between dynamic textboxes

    Here's the code.
    with sdlc I count the number of columns in use. The number of rows with boxes is j (1 to sdlc - 1 [ first column not relevant]).

    What i want is some sort of update where firstcol j + secondcol j = thirdcol j.

    Sub boxes(formname)
    
    On Error Resume Next
    
    Dim ws As Worksheet
    Dim j As Integer
    
    Set ws = ThisWorkbook.Sheets("sheet1")
    
    sdlc = ws.Cells(1, Columns.Count).End(xlToLeft).Column
    
    For j = 1 To (sdlc - 1)
    
        With formname.MultiPage1.page3.Controls.Add("Forms.textbox.1", "firstcol" & j, True)
        .Top = (25 * j) + 20
        .Left = 12
    
        End With
    
    Next j
    
    For j = 1 To (sdlc - 1)
    
        With formname.MultiPage1.page3.Controls.Add("Forms.textbox.1", "secondcol" & j, True)
        .Top = (25 * j) + 20
        .Left = formname.Controls("firstcol" & j).Width + 24
        End With
    
    Next j
    
    For j = 1 To (sdlc - 1)
    
        With formname.MultiPage1.page3.Controls.Add("Forms.textbox.1", "thirdcol" & j, True)
        .Top = (25 * j) + 20
        .Left = formname.Controls("firstcol" & j).Width + formname.Controls("secondcol" & j).Width + 36
        End With
    
    Next j
    
    End Sub

+ 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. [SOLVED] Display value of dynamic ActiveX control textboxes
    By ukflyer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2013, 06:39 AM
  2. Replies: 2
    Last Post: 11-24-2010, 02:47 AM
  3. dynamic row cell counting
    By l14mha in forum Excel General
    Replies: 4
    Last Post: 02-20-2010, 04:36 AM
  4. Replies: 1
    Last Post: 02-08-2008, 02:18 PM
  5. [SOLVED] Counting textboxes
    By franzklammer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-21-2006, 04:35 AM

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