Lookup the value from one sheet and saved to another sheet

Abdulkhadar

Board Regular
Joined
Nov 10, 2013
Messages
165
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Hello Excel Experts,
I want to save the data from Data Entry Sheet to Storing Sheet. At data Entry sheet E1 cells have a unique number same as allready saved in Storing Sheet at Column E.
I want to save the data from Data Entry Sheet to Storing Sheet by using push button.
Lookup the number from Data Entry Sheet E1 in Storing Sheet of column E and copy the data from Data Entry Sheet of column E10 to E31 to Storing Sheet row K to AF and Data Entry Sheet E34 to E51 to row Storing Sheet AF to AX.

Thanks in advance.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hello,

Does this code work as expected?

Code:
Sub COPY_TO_SHEET()
    Application.ScreenUpdating = False
    MY_VALUE = Sheets("Data Entry Sheet").Range("E1").Value
    With Sheets("Storing Sheet")
        For MY_ROWS = 1 To .Range("E" & .Rows.Count).End(xlUp).Row
            If .Range("E" & MY_ROWS).Value = MY_VALUE Then
                Sheets("Data Entry Sheet").Range("E10:E31").Copy
                .Range("K" & MY_ROWS).PasteSpecial (xlPasteAll), Transpose:=True
                Sheets("Data Entry Sheet").Range("E34:E51").Copy
                .Range("AG" & MY_ROWS).PasteSpecial (xlPasteAll), Transpose:=True
            End If
        Next MY_ROWS
    End With
    Application.ScreenUpdating = True
End Sub

On your description did you mean to copy E34:E51 to AG:AX and not AF:AX?
 
Last edited:
Upvote 0
Another option
Code:
Sub CopyTrans()
   Dim Fnd As Range
   Dim Dws As Worksheet
   
   Set Dws = Sheets("Data Entry")
   With Sheets("Storing")
      Set Fnd = .Range("E:E").find(Dws.Range("E1").Value, , , xlWhole, , , False, , False)
      If Not Fnd Is Nothing Then
         .Range("K" & Fnd.Row).Resize(, 22).Value = Application.Transpose(Dws.Range("E10:E31").Value)
         .Range("AG" & Fnd.Row).Resize(, 18).Value = Application.Transpose(Dws.Range("E34:E51").Value)
      End If
   End With
End Sub
 
Upvote 0
Solution
Hello,

Does this code work as expected?

Code:
Sub COPY_TO_SHEET()
    Application.ScreenUpdating = False
    MY_VALUE = Sheets("Data Entry Sheet").Range("E1").Value
    With Sheets("Storing Sheet")
        For MY_ROWS = 1 To .Range("E" & .Rows.Count).End(xlUp).Row
            If .Range("E" & MY_ROWS).Value = MY_VALUE Then
                Sheets("Data Entry Sheet").Range("E10:E31").Copy
                .Range("K" & MY_ROWS).PasteSpecial (xlPasteAll), Transpose:=True
                Sheets("Data Entry Sheet").Range("E34:E51").Copy
                .Range("AG" & MY_ROWS).PasteSpecial (xlPasteAll), Transpose:=True
            End If
        Next MY_ROWS
    End With
    Application.ScreenUpdating = True
End Sub

On your description did you mean to copy E34:E51 to AG:AX and not AF:AX?

Wow Nice it works perfect Thanks once again.
 
Upvote 0
Another option
Code:
Sub CopyTrans()
   Dim Fnd As Range
   Dim Dws As Worksheet
   
   Set Dws = Sheets("Data Entry")
   With Sheets("Storing")
      Set Fnd = .Range("E:E").find(Dws.Range("E1").Value, , , xlWhole, , , False, , False)
      If Not Fnd Is Nothing Then
         .Range("K" & Fnd.Row).Resize(, 22).Value = Application.Transpose(Dws.Range("E10:E31").Value)
         .Range("AG" & Fnd.Row).Resize(, 18).Value = Application.Transpose(Dws.Range("E34:E51").Value)
      End If
   End With
End Sub

This is also works, nice thanks once again
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

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