Results 1 to 7 of 7

Macro Add row & add values in 2 different textbox

Threaded View

  1. #1
    Registered User
    Join Date
    06-06-2012
    Location
    Mexico
    MS-Off Ver
    Excel 2010
    Posts
    99

    Macro Add row & add values in 2 different textbox

    Attachment 195216Hi user's of excel forum!!

    Good Afternoon!

    I have a problem with add row & insert new values in textbox's
    I try to move the select cell to headers "Secondary VALUE" & "Quantity", but this move to other cells and don't stop.

    Attach the workbook and this is the code that I use:TEST PRICING TOOL.xlsm

    For ADD button:
    Private Sub CommandButton22_Click()
    
    Dim R
    
    With Sheets("CUSTOMIZED BOM")
      If Intersect(ActiveCell, .Range("A4:A7000")) Is Nothing Then GoTo einde
    Set R = .Columns(3).Find(ActiveCell, , xlValues, xlWhole)
     With R
      If Not .Offset(WorksheetFunction.CountIf(Columns(3), R), 2) = "C" Then
         .Offset(WorksheetFunction.CountIf(Columns(3), R), 2).EntireRow.Insert
         .Offset(WorksheetFunction.CountIf(Columns(3), R), 2) = "C"
      '
    '----Funcion para copiar la celda en "C", pero valida primero que tenga un valor en "E" para completar
    'En este caso es la funcion customizada "C", que agrega el valor..
          Dim c As Range
            Dim ws As Worksheet
            Dim lRow As Long
         
            For Each ws In Sheets
                With ws
                    lRow = .Range("E" & Rows.Count).End(xlUp).row
                    For Each c In .Range("E4:E" & lRow)
                        If c.Value <> vbNullString Then
                            If c.Offset(0, -2) = vbNullString Then
                                c.Offset(0, -2).Value = c.Offset(-1, -2).Value
                            End If
                        End If
                    Next c
                End With
            Next ws
         
    ' Se llama la funcion de proyectos y se duplica en los rangos
        With Range("B4:B" & Cells(Rows.Count, 3).End(xlUp).row)
                .NumberFormat = "General"
                .Formula = "=C$2"
            End With
    
    
    
    ' En Operation incluye un valor de cero
        With Range("H4:H" & Cells(Rows.Count, 3).End(xlUp).row)
                .Value = "0"
            End With
    
    ' En Extra Info incluye un espacio
        With Range("G4:G" & Cells(Rows.Count, 3).End(xlUp).row)
                .Value = " "
            End With
            
            
        Range("D4").End(xlDown).Offset(1, 0).Select
          newc.Show
      End If
     End With
        Exit Sub
       End With
    einde:  MsgBox "Only Select a cell in range A", , "Complete!"
    
    
    
    End Sub

    For TEXTBOX's:
    Private Sub CommandButton1_Click()
    Unload Me
    End Sub
    
    Private Sub TextBox2_Change()
    Dim myCell As Range
    Dim myTextBox As TextBox
     
    Set myCell = ActiveCell
    ActiveCell.Value = TextBox2.Text
    
    
    
    
    End Sub
    
    Private Sub TextBox3_Change()
    Range("F4").End(xlDown).Offset(1, 0).Select
    Dim myCell As Range
    Dim myTextBox As TextBox
    
    Set myCell = ActiveCell
    myCell.Value = TextBox3.Text
    End Sub
    Best Regards!!
    Last edited by feroguz; 11-20-2012 at 05:19 PM.

Thread Information

Users Browsing this Thread

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

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