Hey all,
I am trying to make a tool that can grab a range of visible rows and modify the text into a format to paste into another program. Currently if no cells are filtered, it works. When there is a filter the results stop at the first hidden row. Any thoughts on how to get all visible fields to be captured when there is a filtered row?
Sub SQL_Generator()
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
' SQL_Generator Macro
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Dim xClipboard As Variant
Dim xJoinRange As Range
Dim xFrom As Range
On Error GoTo ErrHandler
Set xClipboard = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
Set xJoinRange = Application.InputBox(prompt:="SELECT W/O #s", Type:=8)
Set xFrom = xJoinRange.SpecialCells(xlCellTypeVisible)
'xsource = 0
xsource = xFrom.Rows.Count
xTemp = "WORKORDER_CODE=ANY('" & xFrom.Rows(1).Value
For i = 2 To xsource
xTemp = xTemp & "','" & xFrom.Rows(i).Value
Next i
xTemp = xTemp & "')"
xClipboard.SetText xTemp
xClipboard.PutInClipboard
MsgBox "The Following Has Been Copied To Your Clipboard: " & xTemp
ErrHandler:
End Sub
Bookmarks