I have a macro that extracts data from SQL Server and pastes it into a worksheet in Excel. The problem is that once the data are pasted into the Excel worksheet, Excel's "find" function no longer works (i.e., I press CTRL+F, search for text that I know appears in the data, and the search returns nothing). Does importing data from SQL Server do something to the data to change how it can be accessed/searched within Excel?

Here's the code:

'Populate Spreadsheet
If fName = "Customers" Then

Worksheets.Add(After:=Worksheets(Sheets.Count)).Name = "Customers"

'Add Customers to Customers1
customersql = "use database select * from customers" 
Sheets("Customers").Select
With ActiveSheet.QueryTables.Add(Connection:=connstring, Destination:=Range("A1"), Sql:=cystomersql)
.Refresh
End With

Range("A1").Select

Sheets("Customers").Select
Application.Run "'Macro-enabled Pyramid Generator.xlsm'!Customers"
The problem occurs when I try to run the other macro (named "Customers"). Within that macro, there's a command to search through the spreadsheet for a column title and then record that column number as a variable. When that code runs, Excel returns a "Run-Time 91" error: "Object variable or With block variable not set."

When I exit the macro and attempt to find the text myself (outside the macro), the CTRL+F search box returns no results, even though I *see* the text on screen that I'm searching for.

Any help would be appreciated.