Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default adding to a VBA COde

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
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
adding and subtracting using vb code ASU Excel Discussion (Misc queries) 2 October 7th 06 09:48 AM
adding a code to a cell? Brad[_22_] Excel Programming 0 April 11th 06 02:53 PM
adding a code to a cell? Brad[_22_] Excel Programming 2 April 4th 06 10:49 PM
Adding a folder with code Tyrell Excel Programming 3 March 3rd 06 06:43 PM
Dynamically adding code Martin Walke Excel Programming 2 October 21st 04 12:18 PM


All times are GMT +1. The time now is 04:37 AM.

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

About Us

"It's about Microsoft Excel"