Forum Discussion
VBA IF STATEMENTS
I am trying to create IF VBA statements. FYI-I have no knowledge of writing VBA language.
The goal is to create a template for users to use when when requesting wire transfers. On this template there is a Transfer Funds From section and a Transfer Funds To section. Under each section there are information that is needed in order to transfer funds.
Transfer Funds From Section
Information required are:
- Agency
- Bank Name
- Account Number
Transfer Funds To Section
Information required are:
- Beneficiary Name
- Beneficiary Address
- Receiving Bank
- ABA#
- Beneficiary Account Number
I would like that if the user enters the Agency under the Transfer Funds From Section then Bank Name and Account Number will automatically populate. So lets say the Agency's name is entered in cell C7 then the bank name associated with the agency should populate in cell C8 and the Account number associated with the Agency should populate in cell C9.
For the Bank Name I currently have a vLookup formula. So based on what the user entered in cell C7 the bank name would populate. However if I am going to use VBA I would rather use IF statements. For the account number I am currently using IF statements based on what is entered in C7 the account number is populated. Sample formula =IF(C7="Sneaker",99999999).
Under the Transfer Funds To Section if user enters the beneficiary name then the beneficiary address, receiving bank, ABA#, and Beneficiary Account Number will automatically populate. So lets say the beneficiary name is in cell C13 then the beneficiary address should populate in cell C14, receiving bank cell C15, ABA# cell C16, and beneficiary account number cell C17.
Note: in some cases we would not have the beneficiary address. I would also need the VBA language from start to finish.
Any assistance will be greatly appreciated.
Thanks much
hia,
thanks for that. I've attached what I think solves your problem.
on sheet1 i've added 2 tables, one is called tbl_to and one is called tbl_from that contains the details of the accounts.
Then on your template i've added the index match for the various rows. If you change the names you should see the account details change.
10 Replies
- LaToya PhillipCopper ContributorHi Philip I have created a table and was using IF statements however there are multiple Transfer Funds to Agents and Transfer fund to Beneficiaries. I am only able to use the vlookup on the bank name field. Everywhere else I am using IF statements. My concern about using these formulas is for some reason a user may accidentally delete the formulas. I guess I wanted a better way to protect the information on the template.
- Philip WestIron Contributor
Does it have to be VBA? From your description it sounds like it could all be achieved by having a table with the details in and then using more vlookups or index(match()).
- LaToya PhillipCopper Contributor
I am not familiar with the index/match. I tried to do some research on it but was unsuccessful with making it work for my situation do to lack of knowledge.
- Philip WestIron Contributor
Hi LaToya, no worries..
It would help a little if you could upload an workbook that shows the structure of your data and what the end result should look like.