Consulting

Results 1 to 5 of 5

Thread: Based on Cell value, from next cell has to move to 2nd row

  1. #1

    Based on Cell value, from next cell has to move to 2nd row

    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
    Attached Files Attached Files

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,874
    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.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Quote Originally Posted by p45cal View Post
    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
    Attached Images Attached Images

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,874
    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.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  5. #5
    Quote Originally Posted by p45cal View Post
    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •