Replying to:
12-29-2024
01:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
12-29-2024
01:17 PM
@komondormrex great idea just let Excel do the work, did you do a bit of VBA macro so read selection and convert to a single multi value string? Then make the string to be copied.
Threw the question at Copilot and got some really useful starting code and made some changes to it.
Sub JoinColumnValues()
Dim lastRow As Long
Dim i As Long
Dim joinedValues As String
Dim delimiter As String
' Specify the delimiter (e.g., a comma)
delimiter = " "
' Find the last row in column A with data
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
' Loop through each cell in column A
For i = 1 To lastRow
If Cells(i, 1).Value <> "" Then
If joinedValues = "" Then
joinedValues = Chr(34) & Cells(i, 1).Value & Chr(34)
Else
joinedValues = joinedValues & delimiter & Chr(34) & Cells(i, 1).Value & Chr(34)
End If
End If
Next i
joinedValues = "(sssetfirst nil ((lambda ( / s) (setq s (ssadd)) (foreach h '(" & joinedValues & ") (ssadd (handent h) s)))))"
' Output the joined values into a specific cell (e.g., cell B1)
Range("C1").Value = joinedValues
' Inform the user
MsgBox "Values have been joined and placed in cell B1!"
End Sub