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!!
Bookmarks