I have a large number of cells with nothing but text in them. I want to
evaluate the first few words in each and then create a macro to move the
contents of that cell to a new column depending on the cell's contents. Any
creative ideas out there? I am using Excel 2000.Make a list on a new worksheet of those words/phrases.
Put them in A1:Axx.
Then loop through your cells looking for those words/phrases. If you find
it/them, then move the contents and go to the next cell.
dim ListWks as worksheet
dim wks as worksheet
dim myRng as range
dim myCell as range
dim myListRng as range
dim myListCell as range
set wks = worksheets(quot;sheet1quot;)
set listwks = worksheets(quot;listquot;)
with wks
set myrng = .range(quot;a1quot;,.cells(.rows.count,quot;Aquot;).end(xlup))
end with
with listwks
set mylistrng = .range(quot;a1quot;,.cells(.rows.count,quot;Aquot;).end(xlup))
end withfor each mycell in myrng.cells
for each mylistcell in mylistrng.cells
if application.countif(mycell.value,quot;*quot; amp; mylistcell.value amp; quot;*quot;) gt; 0 then
mycell.offset(0,1).value = mycell.value
exit for 'already moved it
end if
next mylistcell
next mycell
=======
Watch out for typos--I didn't test this.Dave B wrote:
gt;
gt; I have a large number of cells with nothing but text in them. I want to
gt; evaluate the first few words in each and then create a macro to move the
gt; contents of that cell to a new column depending on the cell's contents. Any
gt; creative ideas out there? I am using Excel 2000.
--
Dave Peterson
- Aug 14 Mon 2006 20:09
evaluating text cell contents
close
全站熱搜
留言列表
發表留言