+ Reply to Thread
Results 1 to 2 of 2

How MsgBox can show address?

  1. #1
    Milind
    Guest

    How MsgBox can show address?

    Hi
    For each c in worksheets("sheet1").Rows("3:3").Cells
    if c.value = 50 then
    ....
    MsgBox c.address
    (I need this "c" address. When I use ActiveCell.Offset(5), to paste the
    value, the result is 30 rows, then 35 rows ... I want to see what address
    the program is referring to. When comparison is being done (c.value = 50)
    how to get this cell's address and how to put it for others including
    MsgBox. Please help
    Milind



  2. #2
    Rowan Drummond
    Guest

    Re: How MsgBox can show address?

    When you loop through the cells in a range in this manner the activecell
    does not change (unless you have explicitly activate each cell - which
    you probably don't want to do). Select cell A1 then run this as an
    example (you should have at least one cell in row 3 with a value of 50).

    Sub Test()
    Dim c As Range
    For Each c In Rows(3).Cells
    If c.Value = 50 Then
    MsgBox "Activecell is " & ActiveCell.Address & Chr(10) _
    & "Address of c is " & c.Address
    End If
    Next c
    End Sub

    Hope this helps
    Rowan


    Milind wrote:
    > Hi
    > For each c in worksheets("sheet1").Rows("3:3").Cells
    > if c.value = 50 then
    > ...
    > MsgBox c.address
    > (I need this "c" address. When I use ActiveCell.Offset(5), to paste the
    > value, the result is 30 rows, then 35 rows ... I want to see what address
    > the program is referring to. When comparison is being done (c.value = 50)
    > how to get this cell's address and how to put it for others including
    > MsgBox. Please help
    > Milind
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1