Consulting

Results 1 to 6 of 6

Thread: expression for offset()

  1. #1

    expression for offset()

    Hi I am now having a problem with the expression: I wish to express the cell like:
    range("A").offset(0,j)&count1.row (this is of cause wrong)

    or something like: Sheets("Word").Range(("A").Offset(0, j)& count1).Value = Sheets("teams CW").Range("F1").Value (this is also wrong)

    which means the column j from A and then the the cell within it which is determined by row number of count1.row...I have the following but donīt known how to add the offset(j,0) into it to have the right expression....can anyone help with it? thanks!

    [vba]count1 = Source2.Row - Source1.Row + 6
    Sheets("Word").Range("A" & count1).Value = Sheets("teams CW").Range("F1").Value[/vba]

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    [VBA]Sheets("Word").Range("A" & count1).offset(,j).Value = Sheets("teams CW").Range("F1").Value
    [/VBA]

  3. #3
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    if count1 is an integer, perhaps
    [vba]Sheets("Word").Cells(count1, j).Value = Sheets("teams CW").Range("F1").Value [/vba]
    if count1 is a cell,
    [vba]Sheets("Word").Cells(count1.Row, j).Value = Sheets("teams CW").Range("F1").Value [/vba]

  4. #4
    thanks a lot! really thoughtful

  5. #5
    thank you too. but it was not what I meant. nevermind. solved already.:-)

  6. #6
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,646
    If you want to use numbers you'd better use 'cells':


    [vba]
    Sheets("Word").cells(Source2.Row - Source1.Row + 6,1).Value = Sheets("teams CW").Range("F1").Value
    [/vba]

Posting Permissions

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