+ Reply to Thread
Results 1 to 4 of 4

offset of variable giving error

  1. #1
    Forum Contributor timtim89's Avatar
    Join Date
    01-05-2012
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010
    Posts
    141

    offset of variable giving error

    Hey all,

    I am trying to getting the variable myMail to take the value in column F if the column H value of the same row is "x". For some reason I get an error. I hope it will be clearer by taking a look at the attachment or the code.

    Thanks a lot in advance!


    For some reason I can't find the option of inserting code in the special font (it has been some time since I posted here). Sorry about this:

    Sub Mail_Workbook_1()

    Dim myCell As Range
    Dim myMail As String

    For Each myCell In Range("h5:h" & Range("H" & Rows.Count).End(xlUp).Row)

    If myCell = "x" Then

    myMail = Range(myCell).Offset(0, -2).Value

    MsgBox myMall

    End If

    Next

    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: offset of variable giving error

    Try altering the red line
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor timtim89's Avatar
    Join Date
    01-05-2012
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: offset of variable giving error

    That did the trick! Thanks a lot

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: offset of variable giving error

    Your welcome.

+ 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