PC Review


Reply
Thread Tools Rate Thread

Application.left VBA

 
 
Jeff
Guest
Posts: n/a
 
      30th Jan 2009
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 With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      30th Jan 2009
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
(E-Mail Removed)
"Jeff" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 With Quote
 
 
 
 
Jeff
Guest
Posts: n/a
 
      30th Jan 2009
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 With Quote
 
Don Guillett
Guest
Posts: n/a
 
      30th Jan 2009
If? you are saying you want the right, then have a look at RIGHT and LEN

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Jeff" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access VBA - declared an Excel VBA reserved word and VBA/Access won't give it back! ultar6@gmail.com Microsoft Access 1 16th Jun 2007 05:11 AM
using vba to update vba form jrh Microsoft Excel Programming 3 23rd Sep 2003 11:11 PM
Re: VBA code to delete VBA code in another Workbook Chip Pearson Microsoft Excel Programming 0 15th Sep 2003 03:54 PM
Re: Excel 2000 Windows VBA vs. Mac Excel 2001 VBA Harald Staff Microsoft Excel Programming 0 5th Sep 2003 07:45 AM
VBA - Programmatically Change VBA Project Password Glen Microsoft Excel Programming 1 2nd Sep 2003 05:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:32 AM.