+ Reply to Thread
Results 1 to 6 of 6

Moving cursor to the right and more

  1. #1
    Registered User
    Join Date
    06-16-2012
    Location
    Louisville, Kentucky
    MS-Off Ver
    Excel 2010
    Posts
    4

    Question Moving cursor to the right and more

    I'm attempting to scan barcodes that are grouped in two - four barcodes per group, into excel. I'm assuming it will require seperate worksheets for the different groups of barcodes scanned, and that is preferred. The data will be input across two - four columns (depending on the # of barcodes in the group) on the same row. The cursor should then drop to the next row and begin in column A to repeat until I stop. I found an excellent solution to this here by TMShucks, but it only works for two columns across. How do I expand or make it posssible to scan a specified number of columns in VB?

    Thanks,

    trc310

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,321

    Re: Moving cursor to the right and more

    Hi trc310,

    Can you point us to the TMShucks answer so we can see what he did? Then it might be easy to modify his code.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    06-16-2012
    Location
    Louisville, Kentucky
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Moving cursor to the right and more

    This is the code he provided:


    Option Explicit

    Dim MoveRight As Boolean

    Private Sub Worksheet_Change(ByVal Target As Range)

    MoveRight = Not MoveRight
    'Debug.Print MoveRight

    If MoveRight Then
    Target.Offset(0, 1).Select
    Else
    Target.Offset(1, -1).Select
    End If

    End Sub

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,290

    Re: Moving cursor to the right and more

    After a bit of tweaking:

    Please Login or Register  to view this content.

    It's a lot messier than the simple move right or move down but it seems to do the job.


    You can put the Maximum Move Count in a cell on a reference sheet and refer to it using a fully qualified cell address, or using a Named Range or you could even have a Named Range with a constant value.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    06-16-2012
    Location
    Louisville, Kentucky
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Moving cursor to the right and more

    Fantastic! Thank you for being such a tremendous help.

    trc310

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,290

    Re: Moving cursor to the right and more

    You're welcome. Thanks for the rep.


    For future reference: please take a few moments to read the forum rules. You need to add code tags to your (my) code in order to comply with the forum rules ... and strictly speaking, I shouldn't have answered it.

    But hey, first timer, who else is going to answer the question? It took me long enough to work it out. Like all these things, once you ask the question, you often finds lots of ways of answering it.

    Regards, TMS

+ 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