PDA

View Full Version : VBA SQL Query from Cell



LePig
03-05-2018, 06:39 AM
Hi I am trying to get data from a cell and need a little help.



sSQLSting = "SELECT * From (" & Sheets(SpreadsheetName).Cells(firstAddress, Colname + 2) & ")" & vbCrLf


This is returning nothing?

Any help would be appreciated.

https://www.mrexcel.com/forum/excel-questions/1046125-vba-sql-query-cell.html

https://www.excelforum.com/excel-programming-vba-macros/1222691-vba-sql-query-from-cell.html

SamT
03-05-2018, 07:06 AM
Sheets(SpreadsheetName).Cells(firstAddress, Colname + 2) Returns the Data found in that cell. That makes your SQL String look like

sSQLSting = "SELECT * From (42 Lorem Ipsum)
"

Note position of second quote mark