Userform issue...

lucky12341

Board Regular
Joined
Nov 4, 2005
Messages
121
Ok guys here is the dilemna...I have a file I made for work since learning VBA (with beyond excellent help from this board), but I need a last bit of help on it if you guys can...

The code below takes some information I place in text boxes and slams it into a data file. As you can see it does a mini search to locate where to put it and places the data offset of of the location (its a mini warehouse file, they refused to use Access).

The trick I need this to also do is take 3 additional text boxes (that contain information of pulled pieces) and place them in the next available emtpy cell in that row. So they can do multiple pulls of one part without overwriting the information of previous pulls. Any help on this would be greatly apprecaited as my boss is riding me to get this done before monday deadline...thanks a million in advance

Code:
Private Sub cmdAmend_Click()
    Dim strFind, FirstAddress As String
    Dim rSearch As Range
    Set rSearch = Sheet10.Range("a3", Range("a10425").End(xlUp))
    strFind = Me.txtLocation.Value 
    With rSearch
        Set c = .Find(strFind, LookIn:=xlValues)
        If Not c Is Nothing Then
            c.Select
            With Me
                c.Offset(0, 0) = c.Offset(0, 0)
                c.Offset(0, 1).Value = .txtPO.Value
                c.Offset(0, 2).Value = .txtItemNo.Value
                c.Offset(0, 3).Value = .txtPN.Value
                c.Offset(0, 4).Value = .txtPcMk.Value
                c.Offset(0, 6).Value = .txtDescription.Value
                c.Offset(0, 7).Value = .txtHIC.Value
                c.Offset(0, 8).Value = .txtOQty.Value
                c.Offset(0, 5).Value = .txtCQty.Value
                .cmdAmend.Enabled = True 
                .cmdDelete.Enabled = True 
                .cmdAdd.Enabled = False   
                .cmdLocationFindAll.Enabled = True
                .cmdPOFindAll.Enabled = False
                .cmdItemNoFindAll.Enabled = False
                .cmdPNFindAll.Enabled = False
                .cmdPcMkFindAll.Enabled = False
                .cmdDescriptionFindAll.Enabled = False
                .cmdHICFindAll.Enabled = False
            End With
        End If
    End With
End Sub
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

MichaelRo

Well-known Member
Joined
Jun 7, 2004
Messages
549
The following will put the value of your textbox (rename as appropriate) in the next available column at the end of your data:

Code:
c.Offset(0, (Range("IV" & c.Row).End(xlToLeft).Column + 1) - c.Column) = .YourNewTextBox.Value
 

Watch MrExcel Video

Forum statistics

Threads
1,118,435
Messages
5,572,083
Members
412,440
Latest member
jaeremata
Top