copy and search and paste

kamranyd

Board Regular
Joined
Apr 24, 2018
Messages
115
Office Version
  1. 2019
Platform
  1. Windows
Hi, need help in these codes, these codes search in "invdatabase" sheet column G1 for invoice no. if not found than start pasting in "invdatabase" sheet from G1 and so on another columns, my problem is that, it should search the value in G1 but start pasting values from A1 columns and so on....

VBA Code:
 If Rng Is Nothing Then
         Set Rng = Worksheets("invdatabase").Range("G1")
         If Rng.Offset(1, 0) <> "" Then Set Rng = Rng.End(xlDown)
         
      End If
      Rng.Offset(1).Resize(, 13).Value = Array(Quot_No, Quot_Date, Po_No, Po_Date, Do_No, Do_Date, Inv_No, Inv_Date, Cust_Name, Tax_Value, Vat, Total_Amount, Auth_Name)
      i = 13
      For r = 1 To 30
         For j = 1 To 4
         C = Choose(j, 1, 2, 4, 5)
         Debug.Print .Range("A21:A50,B21:B50,D21:D50,E21:E50").Cells(r, C).Address
            Rng.Offset(1, i).Value = .Range("A21:A50,B21:B50,D21:D50,E21:E50").Cells(r, C)
            i = i + 1
         Next j
      Next r
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,148,332
Messages
5,746,139
Members
423,994
Latest member
blzxatly

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
Top