Results 1 to 3 of 3

Thread: Using arrays

  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Location
    Auckland, North Island, New Zealand
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using arrays

    I am using VBA in Excel and am trying to solve the error in the code below (msgbox line);

    r = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Row
    c = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Column
    rangex = Range(Cells(1, 1), Cells(r, c))

    For Each n In rangex

    MsgBox n.Formula
    Next

    Any ideas how to make this work. According to my watch n has the value of the cell. Eg if A1 ="fred" then n ="fred", I need n = A1 so that I can examine each cell

  2. #2
    calacuccia
    Guest

    Re: Using arrays

    Dim rangex As Range, r As Long, c As Long, n As Range
    r = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Row
    c = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Column
    Set rangex = Range(Cells(1, 1), Cells(r, c))

    For Each n In rangex.Cells

    MsgBox n.Formula
    Next

  3. #3
    Star Lounger
    Join Date
    Feb 2001
    Location
    Auckland, North Island, New Zealand
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using arrays

    Thanks for your help, that seems to have fixed it

Posting Permissions

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