Copy formula from left to right and point to newly created tab

bhatipuru

New Member
Joined
Jun 25, 2012
Messages
20
=COUNTIF('05-23'!$B$1:$B$5566,"d*total")
=COUNTIFS('05-23'!$B$1:$B$4935,"D*total",'05-23'!$P$1:$P$4935,0)
=VLOOKUP("Grand Total",'05-23'!$B:$N,9,0)
=VLOOKUP("Grand Total",'05-23'!$B:$N,13,0)
These are the formulas I copy from left column. After i copy, I want to change the lookup tab to the new tab. Ex: In the above formula it is "05-23" and the new tab could be "05-24" or any tab name i assign. How can i macro to write the code.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I'm not a VBA expert, but I just tried using Edit / Find / Replace with the Macro recorder switched on, and it gave me this -
(assuming that the formulas are in the range A1:A4)

Code:
    Range("A1:A4").Select
    Selection.Replace What:="'05-23'", Replacement:="'05-24'", LookAt:=xlPart _
        , SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2

It seems to work, so maybe this will get you started.
Note - there may well be better ways of doing this.
 
Upvote 0

Forum statistics

Threads
1,215,148
Messages
6,123,306
Members
449,095
Latest member
Chestertim

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