Consulting

Results 1 to 4 of 4

Thread: VBA CellMovement from ActiveCell

  1. #1
    VBAX Newbie
    Joined
    Nov 2016
    Posts
    2
    Location

    VBA CellMovement from ActiveCell

    Hello VBA Coders,

    I'm in desire need of help with my code that I am writing.

    I have this code, provided below.

    The movements are set for each scenario.
    For yyy I will be moving 1 row up and 2 columns left to gain the value. or 2 rows up and 2 columns left.(From current active cell.)
    For zzz I wil be moving either one row up or two rows up. (From Current Active Cell.)

    I just want to use the values of yyy and zzz in my input box prompt.

    I have been using different methods (r1c1, offset, and xlup, etc) and have been failing. Any help or sense of direction would be helpful as I have been struggling for hours.

    Sub test()


    Set lol = ActiveCell
    Dim yyy As Range
    Dim zzz As Range


    If lol.Offset(1, 0).Value = "" Then
    yyy = lol.Offset(-1, -2).Value
    zzz = lol.Offset(-1, 0).Value
    Else
    yyy = lol.Offset(-2, -2).Value
    zzz = lol.Offset(-2, 0).Value
    End If


    MsgBox "zzz & yyy"




    End Sub

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    try removing all instances of As Range,





    and change:
    MsgBox "zzz & yyy"
    to:
    MsgBox zzz & yyy
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Newbie
    Joined
    Nov 2016
    Posts
    2
    Location
    Quote Originally Posted by p45cal View Post
    try removing all instances of As Range,





    and change:
    MsgBox "zzz & yyy"
    to:
    MsgBox zzz & yyy
    I have the references working, but now in my input box it won't appear as the values they select, but instead appear as the names *** and yyy.
    Edit = InputBox("Please enter the new price for the Model: & zzz &. The original price of this Model is & yyy &.")

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Edit = InputBox("Please enter the new price for the Model:" & zzz & " The original price of this Model is " & yyy & ".")
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

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