PDA

View Full Version : Based on Cell value, from next cell has to move to 2nd row



krishak77
06-17-2019, 07:41 AM
Hello Everyone,

I need yours support for the below situation.

I am extracting the data from webpage which is in the table, but columns are not same for each rows, i am using below code.

I have attached excel file with 2 sheets (Incorrect) and (Correct), i need how it is in the sheet (correct), but now extracting as in (incorrect) sheet.

Set ele = objIE.document.getElementById("claimItemInformationDiv"). _
getElementsByTagName("td")
y = 0
C = 0
For Each ele In ele
Sheet1.Range("A1").Offset(C, y).Value = ele.innerText
y = y + 1
If y Mod 114 = 0 Then
y = 1
C = C + 1
End If


Next ele


Thanks in advance
Anantha

p45cal
06-17-2019, 12:29 PM
It doesn't look as if there's 114 items on each row of the table on the web, so they're getting out of step.
Also, I wouldn't use the likes of For Each ele In ele, it's mighty confusing - even if it does work!
I would do something along the lines of:

Set eles = objIE.document.getElementById("claimItemInformationDiv").getElementsByTagName("td")
then later:

For each ele in eles.
Send us more details, it could be that you can iterate through the web table row by row, and column by column.
I'm not super-familiar with http.

krishak77
06-18-2019, 10:24 AM
It doesn't look as if there's 114 items on each row of the table on the web, so they're getting out of step.
Also, I wouldn't use the likes of For Each ele In ele, it's mighty confusing - even if it does work!
I would do something along the lines of:

Set eles = objIE.document.getElementById("claimItemInformationDiv").getElementsByTagName("td")
then later:

For each ele in eles.
Send us more details, it could be that you can iterate through the web table row by row, and column by column.
I'm not super-familiar with http.

Hello p45cal,


Thanks for your reply, actually which i have attached file in that i have given example, from the webpage what i am extracting the data it contains 114 items.

As i can't able to share webpage access, i have provided screenshot for your reference, from that if you can help me, i will be very thankful to you.

Starting and ending row i have marked with Yellow in the image, so after that cell should start next row.

Let me know if you need more details.

Thanks in Advance,
Anantha

p45cal
06-18-2019, 11:55 AM
I can't help you with pictures.
I can only guess that the blank values in the second column have no ele associated wuith them.
So you might have to download/examine the first column value too in order to keep the value with what it represents.

krishak77
06-19-2019, 02:32 AM
I can't help you with pictures.
I can only guess that the blank values in the second column have no ele associated wuith them.
So you might have to download/examine the first column value too in order to keep the value with what it represents.

Thanks for your response, the first column value always it will be differ.

Anyway thank you for your time.

Ragards,
Anantha