Find row in excell form 2 cell , is this possible ?

Find row in excell form 2 cell , is this possible ?

Darkforce_the_ilogic_guy
Advisor Advisor
609 Views
3 Replies
Message 1 of 4

Find row in excell form 2 cell , is this possible ?

Darkforce_the_ilogic_guy
Advisor
Advisor

I have this that look are the partnumber in one column.  but I would like to look at more  column... there might be up to four  column that have the same partnumber  the second column might have vaule like DWG , IDW, DXF, DWF... 

 

is it possible to find an row that have the partnumber in the first  column  ,and one of the valuein the second  column.. and then find the value in the 3.  column in the row that have both value

 

ExcelPath  = "H:\link til tegning BC365.xlsx"
	ExcelSheet = "LinkToDrawing"
	
	Dim Partnumber = iProperties.Value("Project", "Part Number")
	
		'Find line with file Item No_	File Type

		GoExcel.Open(ExcelPath, ExcelSheet)
			GoExcel.TitleRow =1
			GoExcel.FindRowStart = 2
			Dim rowNo = GoExcel.FindRow(ExcelPath, ExcelSheet, "Item No_", "=", Partnumber)
'MsgBox(rowNo)
If rowNo > 0 Then
	Drawing = GoExcel.CurrentRowValue("Document Link")
	MsgBox(Drawing)
	
	ThisDoc.Launch(Drawing)
End If 
GoExcel.Close

 

0 Likes
Accepted solutions (2)
610 Views
3 Replies
Replies (3)
Message 2 of 4

S.Hørup
Contributor
Contributor
Accepted solution

I don't know if I have understood you correctly - Your description is a bit confusing IMO.

Also I had to assume you use iLogic 🙂

 

 

But I have made an attempt based on  how I understood it:

 

 

ExcelPath  = "*Insert correct path*\iLogicTest.xlsx"
	ExcelSheet = "Ark1"

Dim Partnumber = iProperties.Value("Project", "Part Number")
Dim DocumentType = "ipt"


GoExcel.Open(ExcelPath, ExcelSheet)
			GoExcel.TitleRow =1
			GoExcel.FindRowStart = 2
			rowNo =  GoExcel.FindRow(ExcelPath, ExcelSheet, "Item No_", "=", Partnumber, "File Type", "=", DocumentType)

'Value of 3. Column
	Dim thirdColumnValue = GoExcel.CellValue("C" & rowNo)
	MsgBox(thirdColumnValue)

 

The FindRow-function is able to take two cels in consideration. So I have actually just added the 2nd column criteria to that line as well.

As you state the value you want from the third column is on the same row, you just have to define the correct Column in the CellValue-function.

 

HAve I understood your problem correctly? If not, please provide an example of your spreadsheet.

Message 3 of 4

Darkforce_the_ilogic_guy
Advisor
Advisor
Accepted solution

I change a lillte in the code. I did not work when the Varibel rowNo was not declared .  and for some unknow Readson .. **** as i type thies I migth have come up with the reason ... because you type Low Cap ...I did not work on my excel document and it keep trying to look for cell C-1... that what happen I gress if it do not find any.

 

when I use the currenRowValue ... it will open the first drawing on the list unless I unless I tell it not to . by making an if statment  if rowNo > 0 .... you help me a lot thank

 

ExcelPath  = "*Insert correct path*\iLogicTest.xlsx"
	ExcelSheet = "Ark1"

Dim Partnumber = iProperties.Value("Project", "Part Number")
Dim DocumentType = "ipt"


GoExcel.Open(ExcelPath, ExcelSheet)
			GoExcel.TitleRow =1
			GoExcel.FindRowStart = 2
			Dim rowNo =  GoExcel.FindRow(ExcelPath, ExcelSheet, "Item No_", "=", Partnumber, "File Type", "=", DocumentType)

'Value of 3. Column
	Dim thirdColumnValue = GoExcel.CurrentRowValue("*Insert Column Titlename here")
if rowNo > 0 then
	ThisDoc.Launch(thirdColumnValue)

end if 

 

0 Likes
Message 4 of 4

Darkforce_the_ilogic_guy
Advisor
Advisor

What I was using this for ....was to look inside an Excel document that was link to an SQl Database.

 

this is only an first draft ...hope to use it for a lot more... like copy description properties form excel to inventor.

 

maybe see stock info or price og raw material and stuff

0 Likes