View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JP[_4_] JP[_4_] is offline
external usenet poster
 
Posts: 897
Default VBA to TRIM data <--Rookie here :o)

I guess it should be

Set rng = Sheets("ODBC Updates").Range("C1:C100")

because you mentioned it was for column C. :-)

(adjust range to suit your needs)

HTH,
JP

On Jan 10, 4:59*pm, JP wrote:
Hello Dan,

You could create an object reference to a range on the ODBC Updates
worksheet, then use the TRIM function on the cells in it. For example

Dim rng As Excel.Range
Dim cell As Excel.Range

Set rng = Sheets("ODBC Updates").Range("A1:E20")

For Each cell In rng
cell = Trim(cell)

Next cell

HTH,
JP