Code for moving focus

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nadahalle
    New Member
    • Apr 2007
    • 3

    Code for moving focus

    Hi All,

    I am trying to develop a form in Vb that stores data in perticular cells based macthing value to the row and colum values in a table.
    I can get focus on the colum value of the table but need to move the focus from 6 colums to the right from the activecell.

    How do i do this? Your help will be greatly appreciated.

    Thank You in advance.

    Vishwas
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by nadahalle
    I am trying to develop a form in Vb that stores data in perticular cells based macthing value to the row and colum values in a table.
    I can get focus on the colum value of the table but need to move the focus from 6 colums to the right from the activecell.
    Can you tell us what version of VB you are using, and what controls you are using?

    Comment

    • nadahalle
      New Member
      • Apr 2007
      • 3

      #3
      Originally posted by Killer42
      Can you tell us what version of VB you are using, and what controls you are using?
      i am using Vb in MS office (excel) 2003 , I am using text boxes and a command botton.

      Thank You

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by nadahalle
        i am using Vb in MS office (excel) 2003 , I am using text boxes and a command button.
        In that case, you're not actually using VB - it's VBA. Similar, but not identical.

        It sounds as though what you want to use is the Offset function (actually, I think it might be a method) to specify a location relative to the current cell..

        Comment

        • nadahalle
          New Member
          • Apr 2007
          • 3

          #5
          Hi killer42

          Mate i sincerely appreciate your help,

          I am an accountant trying to figure out easier way of doing things on excel,
          i found that focus from current cell to where you want by using for example a sample code as below.

          If (SngBustype = "B/Tax") Then
          ActiveCell.Offs et(0, 3).Range("A1"). Select
          ActiveCell.Form ulaR1C1 = CurAmount

          Thank You
          Vishwas

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Originally posted by nadahalle
            I am an accountant trying to figure out easier way of doing things on excel, i found that focus from current cell to where you want by using for example a sample code as below.

            If (SngBustype = "B/Tax") Then
            ActiveCell.Offs et(0, 3).Range("A1"). Select
            ActiveCell.Form ulaR1C1 = CurAmount
            Glad to see you've got your solution. :)

            Don't forget, you can combine things. For instance, you could (probably) have said...
            Code:
            ActiveCell.Offset(0, 3).Range("A1").FormulaR1C1 = CurAmount
            to get the same effect without moving the focus.

            Comment

            Working...