Selecting a cell value in VB for a Query Table

G

Guest

I have created a "Query Table" and have recorded a VB macro of myself editing
the "column to filter"

Here is a snipet of the code that contains the area I would like to edit. I
would like to make the "TUBE_DATA.construction" equal a cell value pulled
from an excel worksheet.

"ripe Colorant Part #`, TUBE_DATA.`Stripe Description`, TUBE_DATA.`Stripe
Colorant Weight`, TUBE_DATA.`Stripe Colorant UOM`" & Chr(13) & "" & Chr(10) &
"FROM TUBE_DATA TUBE_DATA" & Chr(13) & "" & Chr(10) & "WHERE
(TUBE_DATA.Construction='PBF-O-30T-BL-SLT')" _
)
.Refresh BackgroundQuery:=False
End With
End Sub

The "TUBE.DATA.construction" is the column to filter.

"PBF-O-30T-BL-SLT" is the value that I would like to replace with a cell
value pulled out of an excel worksheet.

Please help. Thank you
 
T

Tom Ogilvy

val = Worksheets("Sheet3").Range("B9").Value

"ripe Colorant Part #`, TUBE_DATA.`Stripe Description`, TUBE_DATA.`Stripe
Colorant Weight`, TUBE_DATA.`Stripe Colorant UOM`" & Chr(13) & "" & Chr(10)
&
"FROM TUBE_DATA TUBE_DATA" & Chr(13) & "" & Chr(10) & "WHERE
(TUBE_DATA.Construction='" & val & "')"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top