VBA Question (rookie issue)
Sub FixDescription()
Dim rng as Range, cell as Range, iloc as Long
set rng = Range(Cells(2,3),Cells(rows.count,3).End(xlup))
for each cell in Range
iloc = Instr(1,cell," ",vbTextCompare)
if iloc < 0 then
cell.offset(0,1).Value = mid(cell.Value,iloc+1,255)
cell.Value = left(cell,1,iloc-1)
end if
Next
End Sub
Test it on a copy of your data.
--
Regards,
Tom Ogilvy
"Scott Wagner" wrote in message
...
I thought I was finished with my project... and then my boss stepped in.
One
more thing! :o)
Here is what I have:
Col A = Mark
Col B = Qty
Col C = Item Number
Col D = Description
In the sheet I am working with there is a item number column that contains
at least a part # and in some cases also contains some descriptive text.
I
have a another column for description that in cases where the part # alone
is
in the item number column a description does exist.
In the cases where the item number column contains both the part # and
descriptive text the description column is empty. In those case I want to
move the descriptive text from the item number column to the description
column. The part # is a continueous string, and the descriptive text
begins
after a single space.
Need this in a macro please.
Below is an example.
What I have now:
Mark Qty Ordered Item Number Description 1
M2 1 AB43B Box
M2 1 AEF3422MB Interior
M2 1 AF43SDN Front
4 SG400R Circuit Breaker Enclosure 134
4 SGD32400WL Breaker Catalog Number
2 SKLB36BC1200 Spectra MCB (135S)
1 SRPK1200B1000 Spectra MCB (135S)
1 SRPK1200B1200 Spectra MCB (135S)
4 TGL1 Ground Kit
What I want to end up with:
Mark Qty Ordered Item Number Description 1
M2 1 AB43B Box
M2 1 AEF3422MB Interior
M2 1 AF43SDN Front
4 SG400R Circuit Breaker Enclosure 134
4 SGD32400WL Breaker Catalog Number
2 SKLB36BC1200 Spectra MCB (135S)
1 SRPK1200B1000 Spectra MCB (135S)
1 SRPK1200B1200 Spectra MCB (135S)
4 TGL1 Ground Kit
Thanks in advance!
|