VBA to copy formulas from one tab and paste them into another based on cell value

Joined
Nov 19, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a Database with a Buyer Tab, a Seller Tab, and a Companies Tab. All data is being entered via forms. My admin is going to enter the buyer/seller information first and then the company information. If the buyer or seller's address is the same as the company's address I want her to type in "same" and have a VBA copy the formulas from the formulas tab and paste them into the row and then recopy those cells and paste them as the values only. I also need it to only look for the word "same" in the bottom (or most recently added) row, so that it's not constantly replacing data throughout the entire sheet. Please let me know if this doesn't make sense, or if it's not possible.

Thank you!


Book1.xlsm
ABCDEFGHIJKL
1COMPANIES
2Date:Company Name:Abbreviation:Company Address: (same or different?)Company Address:Company CityCompany StateCompany Zip CodeCompany City & StateFull Address:Owner Type: (Buyer or Seller)Owner's First & Last Name:
310/18/2021Example Co.EXCDifferent123 Example LaneExampleMD32165Example, MD123 Example Lane, Example, MD 32165SellerExample Seller
410/19/2021Example Inc.EXISame321 Example AveExampleMD32165Example, MD321 Example Ave, Example, MD 32165BuyerExample Buyer
510/29/2021Company Name TBDTBDSame123 TBD LaneTBDTBD74185TBD, TBD123 TBD Lane, TBD, TBD 74185SellerTBD Seller
6
Companies
Cell Formulas
RangeFormula
I3:I5I3=CONCAT($F3,", ",$G3)
J3:J5J3=CONCAT($E3,", ",$F3,", ",$G3," ",$H3)
L3:L5L3=IF($K3="seller",XLOOKUP($B3,Sellers!$G:$G,Sellers!C:C,"")&" "&XLOOKUP($B3,Sellers!$G:$G,Sellers!D:D,""),XLOOKUP($B3,Buyers!$F:$F,Buyers!C:C,"")&" "&XLOOKUP($B3,Buyers!$F:$F,Buyers!D:D,""))



Book1.xlsm
ABCDEFGHIJKL
10000
Formulas
Cell Formulas
RangeFormula
E1E1=IF($K1="seller",XLOOKUP($B1,Sellers!$G:$G,Sellers!$J:$J,""),XLOOKUP($B1,Buyers!$F:$F,Buyers!$I:$I,""))
F1F1=IF($K1="seller",XLOOKUP($B1,Sellers!$G:$G,Sellers!$K:$K,""),XLOOKUP($B1,Buyers!$F:$F,Buyers!$J:$J,""))
G1G1=IF($K1="seller",XLOOKUP($B1,Sellers!$G:$G,Sellers!$L:$L,""),XLOOKUP($B1,Buyers!$F:$F,Buyers!$K:$K,""))
H1H1=IF($K1="seller",XLOOKUP($B1,Sellers!$G:$G,Sellers!$M:$M,""),XLOOKUP($B1,Buyers!$F:$F,Buyers!$L:$L,""))
L1L1=IF($K1="seller",XLOOKUP($B1,Sellers!$G:$G,Sellers!$C:$C,"")&" "&XLOOKUP($B1,Sellers!$G:$G,Sellers!$D:$D,""),XLOOKUP($B1,Buyers!$F:$F,Buyers!$C:$C,"")&" "&XLOOKUP($B1,Buyers!$F:$F,Buyers!$D:$D,""))
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
I added the Buyers and Sellers Tabs incase they're helpful.

Book1.xlsm
ABCDEFGHIJKLMNOP
1 BUYERS
2Date:StatusBuyer's First Name:Buyer's Last Name:Buyer's Name:Nick Name:Buyer's Company Name:Email adress:Phone #: Address:Buyer's City:Buyer's State:Buyer's Zip Code:Co-owner:Secondary Email Address:Secondary Phone #:
311/4/2021BuyerPotentialLeadPotential LeadCompany Name TBDLead@email.com(963) 852-7410123 Lead WayLeadMD36985---
411/4/2021BuyerExampleBuyer Example Buyer Example Inc.Buyer@email.com(369) 852-0147321 Example AveExampleMD32165---
Buyers
Cell Formulas
RangeFormula
E3:E4E3=CONCAT(C3," ",D3)



Book1.xlsm
ABCDEFGHIJKLMN
1 SELLERS
2Entry Date:Status:Seller's First Name:Seller's Last Name:Seller's Name:Nick Name:Company Name:Email adress:Phone #: Address:City:State:Zip Code:Referred by:
311/19/21ActiveExampleSellerExample SellerExample Co.exampleco@email.com(987) 654-3210123 Example LaneExampleMD32165N/A
411/19/21ActiveTBDSellerTBD SellerCompany Name TBDSeller@TBD.com(321) 654-9870123 TBD LaneTBDTBD74185N/A
Sellers
Cell Formulas
RangeFormula
E3:E4E3=CONCAT($C3," ",$D3)
 
Upvote 0

Forum statistics

Threads
1,224,821
Messages
6,181,163
Members
453,021
Latest member
Justyna P

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