ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting a cell value in VB for a Query Table (https://www.excelbanter.com/excel-programming/313277-selecting-cell-value-vbulletin-query-table.html)

Jarrett

Selecting a cell value in VB for a Query Table
 
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


Tom Ogilvy

Selecting a cell value in VB for a Query Table
 
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 & "')"

--
Regards,
Tom Ogilvy

"Jarrett" wrote in message
...
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





All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com