Selecting cells with text and placing them in a column

  • Thread starter Thread starter dwojtowi
  • Start date Start date
D

dwojtowi

Hello
Since combo boxes can only read continuous cells, I need to select al
the cells in a column that have text and copy them to a new column...
heres what im looking for

Text1
Formula
Formua...
 
Hi
you may try the following macro which copies the selection without
blanks to the adjacent column
sub foo()
dim rng as range
dim cell as range
dim row_index as long
dim col_index as integer
set rng = selection
if rng.columns.count>1 then exit sub
row_index=rng.row
col_index = rng.column+1
for each cell in rng
if cell.value<>"" then
cells(row_index,col_index).value = cell.value
row_index=row_index + 1
end if
next
end sub
 
Back
Top