Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Find End in Undefined Range Select Range Trim

Hello,

I'm working with .CSV worksheet that arrives already 'Text to Colmuns....'
The data is delimited resulting in various data positioning.

Can someone help with macro that will
1) Find 'END CELL' In sheet given random placement of data
2) Select Range.A1: 'END CELL'
3) Trim all cells within the Range

I've searched through the posted solutions on the subject and tried various
combinations of posts but having no luck

Many thanks / Happy Holidays
Steven
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Find End in Undefined Range Select Range Trim

Steve,

Sub TryNow()
Dim myC As Range
For Each myC In Cells.SpecialCells(xlCellTypeConstants)
myC.Value = Application.Trim(myC.Value)
Next myC
End Sub

HTH,
Bernie
MS Excel MVP


"SteveT" wrote in message
...
Hello,

I'm working with .CSV worksheet that arrives already 'Text to Colmuns....'
The data is delimited resulting in various data positioning.

Can someone help with macro that will
1) Find 'END CELL' In sheet given random placement of data
2) Select Range.A1: 'END CELL'
3) Trim all cells within the Range

I've searched through the posted solutions on the subject and tried various
combinations of posts but having no luck

Many thanks / Happy Holidays
Steven



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Find End in Undefined Range Select Range Trim

First extend activesheet.usedrange back to A1 (may not be necessary):

Sub trimum()
Set rr = Range(Range("A1"), ActiveSheet.UsedRange)
For Each r In rr
r.Value = Trim(r.Value)
Next
End Sub


If your "random placement of data" is not activesheet.usedrange, then update
the second statement accordingly.
--
Gary''s Student - gsnu200759


"SteveT" wrote:

Hello,

I'm working with .CSV worksheet that arrives already 'Text to Colmuns....'
The data is delimited resulting in various data positioning.

Can someone help with macro that will
1) Find 'END CELL' In sheet given random placement of data
2) Select Range.A1: 'END CELL'
3) Trim all cells within the Range

I've searched through the posted solutions on the subject and tried various
combinations of posts but having no luck

Many thanks / Happy Holidays
Steven

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Find End in Undefined Range Select Range Trim

Sub Findntrim()
LastCell = Range("A65536").End(xlUp).Row

For i = 1 To LastCell
Cells(1, i).Value = Trim(Cells(1, i))
Next i
End Sub
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"SteveT" wrote:

Hello,

I'm working with .CSV worksheet that arrives already 'Text to Colmuns....'
The data is delimited resulting in various data positioning.

Can someone help with macro that will
1) Find 'END CELL' In sheet given random placement of data
2) Select Range.A1: 'END CELL'
3) Trim all cells within the Range

I've searched through the posted solutions on the subject and tried various
combinations of posts but having no luck

Many thanks / Happy Holidays
Steven

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Find End in Undefined Range Select Range Trim

Bernie / Student of Gary / Michael

Thank You All for the quick responses!

Bernie, Your solution worked instantly - perfect
Student of Gary, Your's took nano second longer :) - Thanks
Michael, No Luck Sir :)

Again - Thanks !



"SteveT" wrote:

Hello,

I'm working with .CSV worksheet that arrives already 'Text to Colmuns....'
The data is delimited resulting in various data positioning.

Can someone help with macro that will
1) Find 'END CELL' In sheet given random placement of data
2) Select Range.A1: 'END CELL'
3) Trim all cells within the Range

I've searched through the posted solutions on the subject and tried various
combinations of posts but having no luck

Many thanks / Happy Holidays
Steven

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using VBA to find a value and select a range AlexJarvis Excel Worksheet Functions 4 April 27th 10 08:38 PM
select date range then find average of values in another cell rob117 Excel Worksheet Functions 3 May 3rd 07 03:34 PM
help with find value select range and paste to diff sheet, multipl MFR Excel Programming 1 October 29th 06 08:51 PM
Find and select maximum value in a range Mcneilius[_9_] Excel Programming 3 September 18th 05 02:01 PM
How to Select a relative range with Using "Find" and Offset() Dennis Excel Discussion (Misc queries) 7 July 27th 05 03:57 PM


All times are GMT +1. The time now is 02:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"