Updating VBA Formula for Sheet Name

HazatB

New Member
Joined
Sep 19, 2017
Messages
32
Good Morning,

I am attempting to update my excel code as originally split he code per quarter. I have fixed most issues to make the code generic, what I am having issues on is a formula to do a vlookup. any suggestions to complete the fix.

Code:
    ActiveCell.FormulaR1C1 = _
        "=VLOOKUP(RC[-3],qtr3_gl_to_si_allocation_part_b!C[-3]:C,2,FALSE)"
    Range("D1").Select
    Selection.AutoFill Destination:=Range("D1:D" & LastRowT)
    Range("D1:D" & LastRowT).Select
    Range("E1").Select
    ActiveCell.FormulaR1C1 = _
        "=VLOOKUP(RC[-4],qtr3_gl_to_si_allocation_part_b!C[-4]:C[-1],4,FALSE)"
 
Last edited:

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Create a variable called myQuarter then you can say:

Code:
Range("D1:D" & LastRowT).FormulaR1C1 = "=VLOOKUP(RC[-3],qtr" & myQuarter & "_gl_to_si_allocation_part_b!C[-3]:C,2,FALSE)"
Range("E1:E" & LastRowT).FormulaR1C1 = "=VLOOKUP(RC[-4],qtr" & myQuarter & "_gl_to_si_allocation_part_b!C[-4]:C[-1],4,FALSE)"
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

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