Active spreadsheet

Panoos64

Well-known Member
Joined
Mar 1, 2014
Messages
882
Hi all, i have a workbook with many sheets and i would like to modify a little bit the below VBA code so that to runt only in active spreadsheet.

Thanking you in advance


Range("S3").Select
ActiveCell.FormulaR1C1 = _
"=IFERROR(VLOOKUP(RC16,'C:\Users\User\Desktop\[FINGER.xlsx]Sheet1'!R13C2:R10000C47,36,FALSE),"""")"
Range("S3").Select
Selection.AutoFill Destination:=Range("S3:S3050"), Type:=xlFillDefault
Range("S3:S3050").Select
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
If you do not include and sheet references in your range references, it will only run on the ActiveSheet, by default.
So, you shouldn't need to do anything.

If it is not running on the sheet you want it to, that means that you are not on the sheet you think you are when the code runs.
 
Upvote 0
Thanks Joe, i tested and it works as your advice. Thank you so much for your support. Have a nice day
 
Upvote 0

Forum statistics

Threads
1,216,471
Messages
6,130,823
Members
449,595
Latest member
jhester2010

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