Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a spreadsheet of server information with a column called HOSTNAME
where the values are unique and I have other columns such as ENVIRONMENT, CATEGORY, etc that are used to identify the servers function, location, etc. Typically I only look at a specific group of servers based on their ENVIRONMENT or CATEGORY by using an AUTOFILTER. Having said that, after I have filtered my data showing only the rows I want I will often select a group of cells under the HOSTNAME column to be used in other documents, etc. Once I make my selection of cells,Is there a way to pass the values of these cells into a delimited text string or text file? Example of selected sells in HOSTNAME column: HOSTNAME server1 server2 server6 server9 server33 Pass the values into a string or text file as such: server1, server2, server6, server9, server33 Thanks in advance for your advice, Scott |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
After Filtering - Highlight your Hostname Data Only Cells and run:
Sub extractdata() Dim mystring As String ct = Selection.Count With Selection For j = 1 To ct If Selection(1) = Selection(j) Then mystring = Selection(j).Value Else mystring = mystring & "," + Selection(j).Value End If Next j End With Range("G2").Value = mystring ' Or someother cell <<< chg accordingly,,, End That should get you there "PcolaITGuy" wrote: I have a spreadsheet of server information with a column called HOSTNAME where the values are unique and I have other columns such as ENVIRONMENT, CATEGORY, etc that are used to identify the servers function, location, etc. Typically I only look at a specific group of servers based on their ENVIRONMENT or CATEGORY by using an AUTOFILTER. Having said that, after I have filtered my data showing only the rows I want I will often select a group of cells under the HOSTNAME column to be used in other documents, etc. Once I make my selection of cells,Is there a way to pass the values of these cells into a delimited text string or text file? Example of selected sells in HOSTNAME column: HOSTNAME server1 server2 server6 server9 server33 Pass the values into a string or text file as such: server1, server2, server6, server9, server33 Thanks in advance for your advice, Scott |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Const CF_TEXT As Long = 1
Private Function HostNameList() As String Dim HostName As Range For Each HostName In ActiveWindow.RangeSelection HostNameList = HostNameList & "," & HostName.Value Next HostNameList = Mid(HostNameList, 2) Call PutCFTEXTStringOnClipboard(HostNameList) End Function ' Requires the reference "Microsoft Forms 2.0 Object Library" ' Just add a UserForm object and delete it again immediately. Private Sub PutCFTEXTStringOnClipboard(ByRef CF_TEXT_string As String) Dim ClipboardText As New DataObject Call ClipboardText.SetText(CF_TEXT_string, CF_TEXT) Call ClipboardText.PutInClipboard End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
converting line-delimited text into cells | New Users to Excel | |||
Sum delimited values in text string if... | Excel Worksheet Functions | |||
Convert column data to semicolon delimited text string | Excel Worksheet Functions | |||
Extracting Numeric Data from a Delimited Text String | Excel Worksheet Functions | |||
Why can't I Export selected cells to tab-delimited text file? | Excel Discussion (Misc queries) |