View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default taking a word out

This will loop down the column and return the item number via a message box
for each entry.

Sub getItemNbr()
Dim lr As long
lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
Set rng = ActiveSheet.Range("A2:A" & lr) 'assumes hdr row
For Each c In rng
If c < "" Then
x = Left(c, InStr(c, " ") - 1)
MsgBox x
End If
Next
End Sub


"childofthe1980s" wrote in
message ...
Hello:

I have a column that contains an inventory item number followed by a space
and then the word "Average".

How do I take out the space and "Average", so that I can just have the
inventory item number?

There is no set number of characters for the inventory item number.

childofthe1980s