how to quickly fill in a table

coscongr

New Member
Joined
Jan 28, 2018
Messages
13
I have an Excel table of that format

number | description | weight 1 | weight 2 | number | description | weight 1 | weight 2





I have to fill in data by finding the number and manually fill in weight1 and weight2

Is there a way I could just make the data entry quickly instead of finding line by line the right number every time?

The ideal would be something like this:
type a number and automatically send me to the right line to add the two weight numbers
 
Thank you for your help but I have two columns of product codes. A and E.
Also since the columns i have to fill are always C,D AND G,Η could we do something to do directly on these columns?
 
Upvote 0

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Shorter version
Code:
Sub Find_In_Column_A()


Dim FRD As Variant, Find_Range As String: Set B = ActiveSheet


Try_Again:


FRD = Application.InputBox("Insert lookup code")


    On Error GoTo Not_Found
    
    Application.Goto B.Range("A:A").Find(FRD)
    ActiveCell.EntireRow.Select


Exit Sub
Not_Found:
        If MsgBox("The selected code { " & FRD & " } was not found within column A" & vbNewLine & vbNewLine & "Would you like to try again ?", vbYesNo, "Please choose") _
            = vbYes Then GoTo Try_Again


End Sub


Thank you for your help but I have two columns of product codes. A and E.
Also since the columns i have to fill are always C,D AND G,Η could we do something to do directly on these columns?
 
Upvote 0
Thank you for your help but I have two columns of product codes. A and E.
Also since the columns i have to fill are always C,D AND G,Η could we do something to do directly on these columns?
You might be better off with a form but I know nothing about forms so use this till somone else comes along.
Try:
Code:
Sub Find_Value()


Dim Code As Variant, Rrange As Range, Find_Range As String, G As Variant, B As Worksheet
Set B = ActiveWorkbook.ActiveSheet
Try_Again:


            Code = Application.InputBox("Insert lookup code")
            If Code = False Then Exit Sub
            'On Error GoTo Not_Found
Restart:
Application.ScreenUpdating = False
Set Rrange = B.UsedRange.Find(Code)


        Application.Goto Rrange, True
        
        Selection.Offset(0, 1).Resize(Selection.Rows.Count, Selection.Columns.Count + 1).Select
        Application.ScreenUpdating = True
    GoTo Another


Not_Found:


    Code = Application.InputBox("The selected code { " & Code & " } was not found within the current Worksheet" & vbNewLine & vbNewLine & "Would you like to try again with a different Code ?", vbYesNo, "Please choose")
        If Code <> False Then
        
            GoTo Try_Again
            
            Else: Exit Sub


         End If


Another:
    Code = Application.InputBox("Enter another code?")
    If Code = False Then
        Exit Sub
    Else
        GoTo Restart


    End If


End Sub
 
Last edited:
Upvote 0
You might be better off with a form but I know nothing about forms so use this till somone else comes along.
This one might be better for you instead. It will ask you for the code and then ask for the 2 weights separated by a space
Code:
Sub Find_In_Column_A()


Dim Code As Variant, Rrange As Range, Find_Range As String, G As Variant, B As Worksheet, TH(0 To 2) As Variant, L(1 To 2)
Set B = ActiveWorkbook.ActiveSheet


Try_Again:






            
Restart:
TH = Split(Application.InputBox("Input the code and then Weight 1 and then weight 2. Separate each with a space"), " ")
            If Code = False Then Exit Sub
            On Error GoTo Not_Found
            Code = TH(0)
            L(1) = TH(1)
            L(2) = TH(2)
Set Rrange = B.UsedRange.Find(Code)


        Rrange.Offset(0, 1).Resize(Selection.Rows.Count, Selection.Columns.Count + 1) = L
        
    GoTo Another


Not_Found:


    Code = Application.InputBox("The selected code { " & Code & " } was not found within the current Worksheet" & vbNewLine & vbNewLine & "Would you like to try again with a different Code ?", vbYesNo, "Please choose")
        If Code <> False Then
        
            GoTo Try_Again
            
            Else: Exit Sub


         End If


Another:
    Code = Application.InputBox("Enter another code?")
    If Code = False Then
        Exit Sub
    Else
        GoTo Restart


    End If


End Sub
 
Last edited:
Upvote 0
whoops almost forgot place Err.clear somewhere inside the if statement but before the else under the "Not_Found:" label at the bottom
 
Upvote 0
whoops almost forgot place Err.clear somewhere inside the if statement but before the else under the "Not_Found:" label at the bottom
Also replace
Code:
[COLOR=#333333]Selection.Offset(0, 1).Resize(Selection.Rows.Count, Selection.Columns.Count + 1).Select[/COLOR]
With
Code:
[COLOR=#333333]Selection.Offset(0, 2).Resize(Selection.Rows.Count, Selection.Columns.Count + 1).Select[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,242
Members
452,623
Latest member
russelllowellpercy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top