Split ranges(001-005) but keep the associated column

norriz

New Member
Joined
Aug 14, 2010
Messages
30
I have table with a range of numbers with the associated name(below), need to find a way to split ex:001-005 to 001 and table1, 002 and table1, 003 and table1. Can this be done in access or excel. Help needed urgently. Thank you
NumberName
001-005table1
006-010table2
I'd like my final data to look like this-
Number Name
001 Table1
002 Table1
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
That's a great approach, PaulPeter...but I got an error on the line just above "End Sub"
I copied your mini-sheet and ran the code without error so I'm not sure why it doesn't work for you.
I'm guessing at the problem line k=0 but I don't know why. If you step through the code with F8 I'm assuming that it never executes the two lines in the For j ... Next j loop?
 
Upvote 0
Right about never executing the For j loop.

I used this small data sample.

MergeCells05202021.xlsm
AB
1RangeNumber
2002-0095
3007-010, 5556
41437
5501-5128
6600-6068
SheetA
 
Upvote 0
Right about never executing the For j loop.
So when you step past the line below for the first time, what value is held by the variable "itm"?
VBA Code:
For Each itm In Split(Replace(a(i, 1), " ", ""), ",")

I used this small data sample.
What does that sample have to do with this thread?
 
Upvote 0
So when you step past the line below for the first time, what value is held by the variable "itm"?
VBA Code:
For Each itm In Split(Replace(a(i, 1), " ", ""), ",")


What does that sample have to do with this thread?
I was working on another project and the macro was stopped so the clipboard had the incorrect copy. I correct it but you were too fast on the viewing. LOL.
 
Upvote 0
So when you step past the line below for the first time, what value is held by the variable "itm"?
VBA Code:
For Each itm In Split(Replace(a(i, 1), " ", ""), ",")


What does that sample have to do with this thread?
itm is empty

1621988038539.png
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

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