+ Reply to Thread
Results 1 to 4 of 4

Why is command offsetting value?

  1. #1
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Why is command offsetting value?

    Whilst writing a macro I accidently used a range variable instead of the Cells command which acted like an Offset comand.
    Can anyone explain how this works

    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Hi Mudraker.

    It seems that Excel is interpreting your code to be an Offset much like you can use Cells(1,1) instead of Cells(1,1).Value. It's not something I have come across before.

    I don't quite follow your code. What is it supposed to do because when i edit it to your original intentin it does nothing. You don't seem to set the Target.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Being a worksheet change event macro the target range is set by the cells that are changed on the sheet.
    I have a need to paste multiple cells into the sheet which all pasted cell needs to be tested for certain data. This is why I am using the For loop.

    The posted code is only a fraction of the total code & was just to show the reason for my query. My actual code does a lot with the pasted data depending on the column it is in.

    This part of the code was to subtract a cell value from another cell and place the result into column f of the same row.

    Your explanation is about as good as I could come up with & like you I have never heard of it before.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I see now, I didn't relise you were pasting values into the cells.

+ 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