Skip to content

Instantly share code, notes, and snippets.

View priyamshah112's full-sized avatar
🎯
Focusing

Priyam Shah priyamshah112

🎯
Focusing
View GitHub Profile
@priyamshah112
priyamshah112 / searchAndswap.vba
Last active May 17, 2020 14:31
Problem : In Excel, The work of manually searching sap code and matching the product code and then filling quantity against respective sap code in main sheet is tedious and time taking this code automates those efforts. Suppose there are 3 columns in sheet1 SAP_Code, Product_Name, and Product_Qty . Here, you have unique sap code for every produc…
'Problem : In Excel, The work of manually searching sap code and matching the product code and then filling quantity against respective sap code in main sheet is tedious and time taking this code automates those efforts.
'Suppose there are 3 columns in sheet1 SAP_Code, Product_Name, and Product_Qty . Here, you have unique sap code for every product name. You have copied 2 other columns to this sheet1 Shop1_Product_Code and Shop1_Product_Qty to make a order today.
'In general scenario, you have to manually match Shop1_Product_Code with SAP_Code and then copy paste Shop1_Product_Qty to Product_Qty for Ordering.
'This simple vba script automate this process, also it is easily customizable for other search and swap use-cases.
'To Execute the code open a excel sheet with data, press Alt+F11 add this vba script in required sheet. Edit the row and col variables accordingly and Press Run. Wait and See the Magic!
'Updated Code with MsgBox for failed list of match cases
Sub searchAndswap()
' Edit Row_No and Col_No