if i have a sheet called ‘values’ with just 1 column with cells such as:
ColumnA
---------
emp_id
emp_name
dept_id
and then a 2nd sheet called ‘sql’ with 2 columns with cells such as:
ColumnA
--------
="select count(*) from tablex where "&a1&" is null;"
="select count(*) from tablex where length("&a1&") > 10;"
ColumnB
--------
Sheet for null
Sheet for length
What VBA macro code (note i need it in vba as i just want to click one button to generate the sheets) would i need to generate the following two output sheets (each sheet with just one column):
Sheet for null
-------------------
select count(*) from tablex where emp_id is null;
select count(*) from tablex where emp_name is null;
select count(*) from tablex where dept_id is null;
Sheet for length
-------------------
select count(*) from tablex where length(emp_id) > 10;
select count(*) from tablex where length(emp_name) > 10;
select count(*) from tablex where length(dept_id) > 10;
I think this will do what you are asking.
One change I made is that on the “sql” sheet, I changed the cell contents to look like this:
so I used “variable” instead of “&a1&” like you originally had, and then in the code it replaces this word with the correct value of emp_id, emp_name, etc.