Alt+Enter Excel Values combine into a single line

Alt+Enter Excel Values combine into a single line

AMN3161
Advocate Advocate
518 Views
4 Replies
Message 1 of 5

Alt+Enter Excel Values combine into a single line

AMN3161
Advocate
Advocate

Hello

 

Is there a quick way to use logic to take multiple values in a excel cell that were Alt+Enter'ed and combine them into a single line? then populate a iproperty with it?

0 Likes
Accepted solutions (1)
519 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

Could you give more info?

If your cell value is:

AAA

BBB

CCC

Do you want your iporperty to be AAABBBCCC or something else? (AAA-BBB-CCC, AAA BBB CCC)

Do you want to copy it to one single iproperty? Which one?

0 Likes
Message 3 of 5

AMN3161
Advocate
Advocate

I would prefer to have spaces if that the easiest route

 

So if its

 

AAA

BBB

CCC

 

I want the iproperty to be AAA BBB CCC

0 Likes
Message 4 of 5

Anonymous
Not applicable
Accepted solution
Dim CellValue As String = GoExcel.CellValue("YourExcelFilePathAndFilename", "SheetName", "CellAdress e.g. A1")
Dim StrArray As Object
Dim StrResult As String = ""
StrArray = Split(CellValue,vbLf)
For i = LBound(StrArray) To UBound(StrArray)
	If StrResult = "" Then 
		StrResult = StrResult & StrArray(i)
	Else
		StrResult = StrResult & " " & StrArray(i)
	End If
Next
iProperties.Value("Summary", "Title") = StrResult

That is for Title property. For another iproperties just change last line

0 Likes
Message 5 of 5

AMN3161
Advocate
Advocate

Should of mentioned its for a find row but some tweaking and it works beautifully

 

GoExcel.TitleRow = 10
GoExcel.FindRowStart = 11

i = GoExcel.FindRow(iProperties.Value("Custom", "Project_BOM"), "BOM", "Manufacturer Part No.", "=", iProperties.Value("Project", "Part Number"))

If i = -1

iProperties.Value("Project", "Stock Number") = "This Part Number is number is not in the Project BOM"
		
Else

Dim CellValue As String = GoExcel.CurrentRowValue("P&ID Tag(s)")
Dim StrArray As Object
Dim StrResult As String = ""
StrArray = Split(CellValue,vbLf)
For i = LBound(StrArray) To UBound(StrArray)
	If StrResult = "" Then 
		StrResult = StrResult & StrArray(i)
	Else
		StrResult = StrResult & " " & StrArray(i)
	End If
Next
iProperties.Value("Project", "Stock Number") = StrResult

End If

Thank you so much!

0 Likes