move to new line help please

Wildfireau

New Member
Joined
Mar 11, 2011
Messages
2
hi everyone i just have one question i'm totally new to macros and i need some help i have a whole lot of data entry to do and i was wondering is it possible to write a script that will automatically move the active cell down one position after a cell has 12 characters placed in it, as i am going to be scanning a whole bunch of 12 digit barcodes


thanks heaps i hope someone can help
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Wildfireau
I dont know of a way directly doing it within the cell.
So the way that i would do this is, create a Userform and add a single text box. Then add the following code to the userform.


Code:
Private Sub TextBox1_Change()
    If Len(TextBox1.Text) = 12 Then
        ActiveCell.Value = TextBox1.Value
        TextBox1.Value = ""
        ActiveCell.Offset(1, 0).Select
    End If
End Sub

To open the user form use the following code
Code:
Sub OpenMyUserForm()
     UserForm1.Show
End Sub

Thanks
tigs
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top