Macro help. (IE: If a cell equals travel then return travel in next column)

Stacy2927

New Member
Joined
Jun 16, 2020
Messages
5
Office Version
  1. 2010
Platform
  1. Windows
I need some help! I don't have a lot of experience with Macros. I'm looking for a formula that in a macro that If cell F2 = Travel then return Travel in G2, If cell F2 = Dues And Subscriptions then return Dues And Subscriptions in G2, If cell F2 = Meals then return Meals in G2. If it is anything else to return Other.

1592333196015.png
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Any particular reason you need a macro? That could be done very easily with a simple formula.
 
Upvote 0
I'm wanting to be able to paste the information in and click the command button and everything else populates.
 
Upvote 0
I think I figured it out. This seems to work.

Range("G1").Select
Selection.Copy
Range("G1").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("G2").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-1]=""Travel"",""Travel"",IF(RC[-1]=""Dues and Subscriptions"",""Dues & Sub"",IF(RC[-1]=""Meals"",""Meals"",IF(RC[-1]=""Supplies"",""Office Supplies"",""Other""))))
 
Upvote 0
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,823
Members
449,049
Latest member
cybersurfer5000

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