none
Offset and References RRS feed

  • Question

  • Hi,

    Bets_Temp_Bet_Number is a defined Name  - T3 - value = 5

    This doesn't work - ActiveCell.Offset(Bets_Temp_Bet_Number, 1) = "a"

    This obviously does work = ActiveCell.Offset( 5, 1) = "a"

    I'm stupid or tired - I'm hoping its the latter.

    Craig


    • Edited by Craig_M17 Thursday, September 28, 2017 7:36 PM
    • Moved by KareninstructorMVP Friday, September 29, 2017 12:42 AM moved from vb.net
    Thursday, September 28, 2017 7:26 PM

All replies

  • What is the context you are coding in e.g. in a VB.NET project, within Excel module ?


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Thursday, September 28, 2017 7:59 PM
  • Hi Karen,

    Just trying to do a more complex Macro in Excel.

    Sorry I don't know Excel that well when using Macro's.

    The Macro works when I use the constant 5 but it doesn't work when I use me variable Named  Bets_Temp_Bet_Number.

    I'm not sure if that actually helps you at all.

    I might just need to add huge amout to get me sorted.

    I want to select a cell in a region eg N3:P10, ie anywhere inside that region.

    I then want to press a button that buts the detail of the Row, the column and the detail into another region say Q:10,Q11 and Q12.

    Good luck

    Thursday, September 28, 2017 8:54 PM
  • If you want me too I can move your question to the "Excel for developer's forum" which would be a better forum since this is Excel specific.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Thursday, September 28, 2017 9:05 PM
  • Hi Karen,

    Thanks very much that would be great,

    Take care

    Craig

    Thursday, September 28, 2017 9:34 PM
  • Hello,

    >>Bets_Temp_Bet_Number is a defined Name  - T3 - value = 5

    How do you define "Bets_Temp_Bet_Number "?  

    Please test if the following code works for you.

    Sub test()
    Dim a As Variant
    a = 5
    ActiveCell.Offset(a, 1) = "test"
    End Sub

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, October 4, 2017 6:37 AM
    Moderator