Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use variables in sql statement
I've built an sql string to get records from a database and store to excel.
sSql = "SELECT * FROM myTableName" I want to replace myTableName with a variable (TableVar) to reference the tablename typed in Cell A1. I assigned the variable TableVar by doing the following: TableVar = ActiveWorkbook.Worksheets("sheet1").Range("B1").Va lue When I replace myTableName with TableVar, I get an error message that there is no such table as TableVar. What is the correct way to replace a table name with a variable? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF Statement with two variables | Excel Worksheet Functions | |||
how do i if statement for 3 variables | Excel Worksheet Functions | |||
Conditional Statement with many variables | Excel Discussion (Misc queries) | |||
Too many variables for an if than statement? | New Users to Excel | |||
Variables in a Range statement | Excel Programming |