change vba code from year to year
I have some vba code that contains exact information that needs to be flexible. I've included a portion of code with a cell value below, but some vba references a file name or drive information with the year 2016.
For i = 2 To lastRow
If Cells(i, 8).Value = "2016" Then
Cells(i, 1).Resize(1, 20).Interior.ColorIndex = 36
I would like to be able to change a specific word/number without manually accessing module and find/replacing all 2016.
Is there another option?
Re: change vba code from year to year
I would normally create a "configuration" or "control" sheet and store that kind of variable information there. I usually define Named Ranges so that the structure of the configuration sheet is also flexible. Then you never touch the code.
Trevor Shuttleworth - Excel Aid
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By RonRich in forum Excel Formulas & Functions
Last Post: 01-05-2015, 08:29 AM
By trumptight in forum Word Programming / VBA / Macros
Last Post: 08-21-2014, 10:38 PM
By JasonMcQueen in forum Excel Charting & Pivots
Last Post: 06-29-2014, 02:52 PM
By Jamon Fries in forum Excel Formulas & Functions
Last Post: 03-11-2014, 05:29 PM
By cdixon01 in forum Excel Formulas & Functions
Last Post: 09-04-2013, 10:49 AM
By miam in forum Excel Programming / VBA / Macros
Last Post: 07-25-2011, 03:33 AM
By George in forum Excel General
Last Post: 07-19-2006, 02:34 PM
Tags for this Thread
Search Engine Friendly URLs by vBSEO 3.6.0 RC 1