Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6880335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:57:39+00:00 2026-05-27T04:57:39+00:00

I have absolutely no experience programming in excel vba other than I wrote a

  • 0

I have absolutely no experience programming in excel vba other than I wrote a function to add a data stamp to a barcode that was scanned in on our production line a few weeks back, mainly through trial and error.

Anyways, what I need help with right now is inventory is coming up and every item we have has a barcode and is usually scanned into notepad and then manually pulled into excel and “text to columns” is used. I found the excel split function and would like a little bit of help getting it to work with my scanned barcodes.

The data comes in in the format: 11111*A153333*11/30/11 plus a carriage return , where the * would be the delimiter. All the examples I’ve found don’t seem to do anything, at all.

For example here is one I found on splitting at the ” “, but nothing happens if I change it to *.

Sub splitText()

'splits Text active cell using * char as separator
Dim splitVals As Variant
Dim totalVals As Long

splitVals = Split(ActiveCell.Value, "*")
totalVals = UBound(splitVals)

Range(Cells(ActiveCell.Row, ActiveCell.Column + 1), Cells(ActiveCell.Row, ActiveCell.Column + 1 + totalVals)).Value = splitVals
End Sub

And this is applied in the Sheet1 code section, if that helps.

It really can’t be this complicated, can it?

Edit: Trying to add in Vlookup to the vba.

So as I said below in the comments, I’m now working on getting the vlookup integrated into this, however it just returns N/A.

Here is the sub I wrote based on the link below

Public Sub vlook(ByRef codeCell As Range)
Dim result As String
Dim source As Worksheet
Dim destination As Worksheet
Set destination = ActiveWorkbook.Sheets("Inventory")
Set source = ActiveWorkbook.Sheets("Descriptions")

result = [Vlookup(destination!(codeCell.Row, D), source!A2:B1397, 2, FALSE)]
End Sub

And I was trying to call it right after the For loop in the worksheet change, and just created another for loop, does this/should this be a nested for loop?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:57:40+00:00Added an answer on May 27, 2026 at 4:57 am

    Just adding the code to the VBA behind the worksheet won’t actually cause it to get called. You need to handle the worksheet_change event. The following should help:

    Private Sub Worksheet_Change(ByVal Target As Range)
        Application.EnableEvents = False
        Dim cell As Range
        For Each cell In Target.Cells
            If cell.Column = 1 Then SplitText cell
        Next
        Application.EnableEvents = True
    End Sub
    
    Public Sub SplitText(ByRef codeCell As Range)
    
        'splits Text active cell using * char as separator
        Dim splitVals As Variant
        Dim totalVals As Long
    
        splitVals = Split(codeCell.Value, "*")
        totalVals = UBound(splitVals)
    
        Range(Cells(codeCell.Row, codeCell.Column), Cells(codeCell.Row, codeCell.Column + totalVals)).Value = splitVals
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an absolutely positioned div that has a width of 100% with a
I have 2 divs, one positioned absolutely right: 0 and the other relatively positioned
So I have this template design that is currently absolutely positioned, but I'm trying
I have never used dll's before(absolutely no experience) and I wanted to replace a
I'm a fairly fresh developer, and so have absolutely no complex experience with build
I have absolutely no experience or knowledge regarding hardware registers and how to interface
We have a user experience designer in our team who has no programming background.
Im have absolutely no experience with .htaccess and i tried something today. I basicly
I have absolutely no idea how to do this, so I'm just gonna go
I have absolutely no idea why this is happening but the following code seems

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.