Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    9

    Unanswered: iteration in excel vba

    i have an exported repot into excel that has a header for a person, then rows of numbers for that person, then a header for the next person and their numbers under that and so on. since these numbers change and the amount of numbers does not stay the same, is there a way i can use vba to start at the first person, iterate through his/her numbers top the last one and reference that to a cell, then continue onto the next person, iterate through their numbers to the last one and reference that number to the next cell? does this make any sense? any help would be appreciated. thanks!

    cj

  2. #2
    Join Date
    Nov 2003
    Posts
    6
    If there is some recognition of the header possible
    dim val as variant
    dim nperson as integer
    dim nparameter as integer
    dim r as integer 'row
    dim goon as boolean
    '
    nperson = 0
    nparameter = 0
    goon = true
    r = 1
    while goon
    val = workbooks("...").sheets("...").cells(r,...)
    if isempty(val) then
    goon=false
    else
    if ThisIsAPerson(val) then 'Here recognize a name
    nperson=nperson+1
    nparameter=0
    workbooks("...").sheets("...").cells(nperson,...) = r
    else
    nparameter = nparameter +1
    end if
    end if
    r=r+1
    wend

    You can use information like ...Cells(r,...).Interior.Color
    or TypeName(val)="String"

  3. #3
    Join Date
    Oct 2002
    Location
    Argentina
    Posts
    72

    Re: iteration in excel vba

    I can develop it for you.

    Originally posted by cjwang80
    i have an exported repot into excel that has a header for a person, then rows of numbers for that person, then a header for the next person and their numbers under that and so on. since these numbers change and the amount of numbers does not stay the same, is there a way i can use vba to start at the first person, iterate through his/her numbers top the last one and reference that to a cell, then continue onto the next person, iterate through their numbers to the last one and reference that number to the next cell? does this make any sense? any help would be appreciated. thanks!

    cj

Posting Permissions

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