A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Discussion (Misc queries)
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Application.left VBA



 
 
Thread Tools Display Modes
  #1  
Old January 30th 09, 04:43 PM posted to microsoft.public.excel.misc
Jeff
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

Ads
  #2  
Old January 30th 09, 04:57 PM posted to microsoft.public.excel.misc
Don Guillett
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  
Old January 30th 09, 05:18 PM posted to microsoft.public.excel.misc
Jeff
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
>

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
LEFT function-all to left of a comma? Jennifer F Excel Worksheet Functions 1 January 21st 09 11:19 PM
when inserting new worksheets they read right to left not left to. Andy Setting up and Configuration of Excel 2 December 3rd 08 09: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 11:03 AM
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 12:55 AM.


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