#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 921
Default Application.left VBA

Can somenone help fixing the VBA macro?
Sub trimit()
Dim rng As Range
Set target = Range("A2:H" & Range("A2").End(xlDown).Row)
Set rng1 = Range("F2:H" & Range("F2").End(xlDown).Row)
For Each cell In target
cell.Value = Trim(Application.Left(Range("target")), 10, 0
Range("rng1") = cell.Value
Next
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Application.left VBA

maybe to get the left 10 characters in cell F.

Sub trimit()
for each c in Range("A2:H" & Range("A2").End(xlDown).Row)
c.Value = left(c.offset(,5),10)
'or to trim the cell first and then get the left 10
'c.Value = left(application.trim(c.offset(,5)),10)

Next c
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Jeff" wrote in message
...
Can somenone help fixing the VBA macro?
Sub trimit()
Dim rng As Range
Set target = Range("A2:H" & Range("A2").End(xlDown).Row)
Set rng1 = Range("F2:H" & Range("F2").End(xlDown).Row)
For Each cell In target
cell.Value = Trim(Application.Left(Range("target")), 10, 0
Range("rng1") = cell.Value
Next
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 921
Default Application.left VBA

What I need is to put the value c in column F after "left" and "trim".


"Jeff" wrote:

Can somenone help fixing the VBA macro?
Sub trimit()
Dim rng As Range
Set target = Range("A2:H" & Range("A2").End(xlDown).Row)
Set rng1 = Range("F2:H" & Range("F2").End(xlDown).Row)
For Each cell In target
cell.Value = Trim(Application.Left(Range("target")), 10, 0
Range("rng1") = cell.Value
Next
End Sub

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
LEFT function-all to left of a comma? Jennifer F Excel Worksheet Functions 1 January 22nd 09 12:19 AM
when inserting new worksheets they read right to left not left to. Andy Setting up and Configuration of Excel 2 December 3rd 08 10:51 PM
My Excel view is Right to Left instead of Left to Right !!! Akash Puri Excel Discussion (Misc queries) 2 May 5th 08 07:15 PM
Column labels run right to left, not left to right tmassey Excel Discussion (Misc queries) 1 November 10th 06 12:03 PM
How to change the right-to-left worksheet to left-to-right workshe RAMA Excel Discussion (Misc queries) 1 July 4th 05 01:57 PM


All times are GMT +1. The time now is 04:49 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"