Hello,
I regularly find myself manually changing the SQL in many different worksheets owing to a minor change in the criteria. For each sheet, the SQL is the same other than for the filtered field, Specialty. So: one sheet for Cardiology, one for Ophthalmology etc.
I think this must be possible using VBA but I'm not good with VBA so I need some help please.
What I want is some code that will:
In a couple of years of using VBA pilfered from forums such as this, this is the first time I've had to post! Thanks in advance for your help and apologies if I've missed anything I should have included in this post.
John
I regularly find myself manually changing the SQL in many different worksheets owing to a minor change in the criteria. For each sheet, the SQL is the same other than for the filtered field, Specialty. So: one sheet for Cardiology, one for Ophthalmology etc.
I think this must be possible using VBA but I'm not good with VBA so I need some help please.
What I want is some code that will:
- Loop through all of my worksheets where the worksheet name contains "filter"
- I need it to updating the SQL to the standard SQL I have (select * from A where specialty = '<SPECIALTY>')...
- ...where the <SPECIALTY> is fed by the first six letters of the worksheet name.
In a couple of years of using VBA pilfered from forums such as this, this is the first time I've had to post! Thanks in advance for your help and apologies if I've missed anything I should have included in this post.
John