PC Review


Reply
Thread Tools Rate Thread

adding to a VBA COde

 
 
=?Utf-8?B?ZGlhY2NpMXN0?=
Guest
Posts: n/a
 
      23rd Nov 2006
Hi
The below code I am running works ok but I need to add an other part to it
as this one:
If Left(s, 1) = "1" Then
i = 183
iloc = InStr(i, s, " ", vbTextCompare)
t = 202
tloc = InStr(t, s, " ", vbTextCompare)

s1 = Left(s, i - 1)
s3 = Right(s, Len(s) - iloc)
s2 = "*************** "
Cell.Value = s1 & s2 & s3
But I am not too sure how to do it....
could you please help?
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


Sub AABB()

For Each Cell In Range("A1:A65000")
s = Cell.Value
If Left(s, 1) = "1" Then
i = 208
iloc = InStr(i, s, " ", vbTextCompare)
t = 223
tloc = InStr(t, s, " ", vbTextCompare)

s1 = Left(s, i - 1)
s3 = Right(s, Len(s) - iloc)
s2 = "*************** "
Cell.Value = s1 & s2 & s3


ElseIf Left(s, 1) = "2" Then
i = 61
iloc = InStr(i, s, " ", vbTextCompare)
t = 76
tloc = InStr(t, s, " ", vbTextCompare)


s1 = Left(s, i - 1)
s3 = Right(s, Len(s) - tloc)
s2 = "*************** "
Cell.Value = s1 & s2 & s3

Else

End If
Next
Cells.Select
Selection.Replace What:="""", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
 
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
Creating excel file, adding code to it from code, VBE window stays BlueWolverine Microsoft Excel Programming 0 5th Nov 2009 07:55 PM
code for adding media player using c# code ram achar Microsoft C# .NET 0 14th Feb 2007 08:58 PM
Shorten code to apply to all sheets except a few, instead of individually naming them, and later adding to code. Corey Microsoft Excel Programming 3 11th Dec 2006 05:14 AM
Adding code to existing Code Heather Microsoft Access VBA Modules 0 24th Aug 2004 07:26 PM
Adding Code Groups and PermissionSets through code Thomas Delrue Microsoft Dot NET Framework 2 30th Oct 2003 12:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:58 AM.