+ Reply to Thread
Results 1 to 6 of 6

Offset question

  1. #1
    Patrick Simonds
    Guest

    Offset question

    I want this code to function on the current position, 13th column

    So if I am in A1 it should be looking at M1

    If ActiveSheet.Range(1, 13) = "" Then
    OptNoL.Value = True
    ElseIf ActiveSheet.Range(1, 13) = 30 Then
    opt30L.Value = True
    ElseIf ActiveSheet.Range(1, 13) = 60 Then
    opt60l.Value = True



  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    HI,

    Change your statement From:

    ActiveSheet.Range(1, 13).Value

    To this:

    ActiveSheet.Cells(1, 13).Value

    Hope this helps,
    Leith Ross

  3. #3
    swisse
    Guest

    RE: Offset question

    Patrick,
    Use Cells():
    If Cells(1, 13).Value = "" Then
    OptNoL.Value = True
    ElseIf Cells(1, 13).Value = 30 Then
    opt30L.Value = Tue
    ElseIf Cells(1, 13).Value = 60 Then
    opt60l.Value = True
    End If

    Swisse

  4. #4
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    The OP's requirement looks quite vague. Maybe he needs something like:

    If ActiveSheet.Cells(1, ActiveCell.column+13) = "" Then
    OptNoL.Value = True
    ElseIf ActiveSheet.Cells(1, ActiveCell.column+13) = 30 Then
    opt30L.Value = True
    ElseIf ActiveSheet.Cells(1, ActiveCell.column+13) = 60 Then
    opt60l.Value = True


    - Mangesh

  5. #5
    Norman Jones
    Guest

    Re: Offset question

    H Patrick.

    Try:

    With ActiveCell.Offset(0,12)
    If .Value = "" Then
    OptNoL.Value = True
    ElseIf .Value = 30 Then
    opt30L.Value = True
    ElseIf .Value = 60 Then
    opt60l.Value = True
    Else
    'Leave unchanged '<<===== ???
    End If
    End With


    (Note that Range("A1").Offset(1,13) returns the N2 cell)


    ---
    Regards,
    Norman



    "Patrick Simonds" <[email protected]> wrote in message
    news:[email protected]...
    >I want this code to function on the current position, 13th column
    >
    > So if I am in A1 it should be looking at M1
    >
    > If ActiveSheet.Range(1, 13) = "" Then
    > OptNoL.Value = True
    > ElseIf ActiveSheet.Range(1, 13) = 30 Then
    > opt30L.Value = True
    > ElseIf ActiveSheet.Range(1, 13) = 60 Then
    > opt60l.Value = True
    >




  6. #6
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Oops mistake. Thanks Norman. Thus the solution I proposed changes to:

    If ActiveSheet.Cells(1, ActiveCell.column+12) = "" Then
    OptNoL.Value = True
    ElseIf ActiveSheet.Cells(1, ActiveCell.column+12) = 30 Then
    opt30L.Value = True
    ElseIf ActiveSheet.Cells(1, ActiveCell.column+12) = 60 Then
    opt60l.Value = True

    13 is replaced by 12.


    - Mangesh

+ 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