transferring information into a new line on another tab using macro button

rmcc

New Member
Joined
Dec 23, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have the following input sheet on tab 1 of my excel:

1671805864129.png



and the following on tab 2:

1671805614594.png


I want to insert a macro button that transfers the relevant info from the input sheet into the table on tab 2 (e.g. the lot, the name, cat. number, x number and the value of x)
The problem I'm having is that each time a new input is completed within the input template, I need the new info to populate the next consecutive line of my database on tab 2. Is this possible?

Any help with this would be greatly appreciated!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Copy and paste this macro into the worksheet code module. Do the following: right click the tab 2 name for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Change the tab 2 name (in red) to suit your needs. Close the code window to return to your sheet. Enter a value and press the ENTER key. No button is necessary.
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Intersect(Target, Range("D:D,E:E")) Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    Dim desWS As Worksheet
    Set desWS = Sheets("Sheet2")
    Select Case Target.Row
        Case Is = 4
            desWS.Cells(desWS.Rows.Count, "A").End(xlUp).Offset(1) = Target
        Case Is = 5
            desWS.Cells(desWS.Rows.Count, "B").End(xlUp).Offset(1) = Target
        Case Is = 6
            desWS.Cells(desWS.Rows.Count, "C").End(xlUp).Offset(1) = Target
        Case Is = 7
            desWS.Cells(desWS.Rows.Count, "D").End(xlUp).Offset(1) = Target
        Case Is = 10
            desWS.Cells(desWS.Rows.Count, "E").End(xlUp).Offset(1) = Target
    End Select
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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