Results 1 to 3 of 3

Thread: Excel Question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    76
    try this
    dim x as new excel.application
    x = getobject(,"Excel.application")
    x = getobject("c:\test.xls")

    now try

    x.application.sheets("Sheet1").select

    x.application.row ..........
    or else see Getobject example in vb help
    Dim col as Varient, row as Integer
    For col = A to Z
    For row = 1 to 15
    Xl.Range(col,row).Select
    'get value and do stuff to it
    Next row
    Next col

    I'm trying very hard but can't find any answers,Thanks in advance.

    Joey O. [/B][/QUOTE]

  2. #2
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232
    Ok here's the deal.

    When pointing to a cell in a range in excel I usually don't use the "A1" notation but (rownumber, colnumer). So a code to loop through a column would look like:
    Code:
    Dim iCol as Integer, iRow as Integer
    For iCol = 1 to 100 'or whatever number or columns
      For iRow = 1 to 100 'or whatever number or rows
        'This line prints values in cells in the active worksheet:
        Debug.Print Cells(iRow,iCol).Value
        'This line puts the row and column number in the cells:
        Cells(iRow,iCol).Value = "'" & iRow & ";" & iCol
      Next iRow
    Next iCol
    [Edited by pardede on 05-22-2000 at 08:41 AM]

  3. #3
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    pardede,
    Your awsome.Thanks, this code'll open up a lot of doors for me.
    Thank You,
    Joey O.

Posting Permissions

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



Click Here to Expand Forum to Full Width