Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default len replace part 2

**<__**........<__........SS<__..........<__DD DDDDDDDD<__
**<__**........<__..........<__..SSDDDDDD<__DD DD..DDDD<__
**<__**........<__........SS<__....DDDDDD<__DD DDDDDDDD<__
**<__**........<__SSDDDDDDDD<__DDDDDDDD..<__.. ........<__
**<__**......SS<__DDDDDDDDDD<__DDDDDDDDDD<__.. ........<__
**<__**....SSDD<__DDDDDDDDDD<__DDDDDDDD..<__DD DDDDDDDD<__

Hi all, this brilliant code below worked and because it worked so well, my
boss has decided he wants the same for absences for which there are 2 letters
D and S, as you can see above. . I can't run them one letter at a time
because that'll overwrite the 1st letter. Can anyone change this code show D
and S on the one spreadsheet. I've tried and made a mess of it.

PS Rick, you were right about the 1/2 days . Thanks again


Sub GetHolidayDates()
Dim X As Long, Z As Long
Dim StartRow As Long, LastRow As Long, Col As Long
Dim CodedDate As String
StartRow = 1
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For X = StartRow To LastRow
Col = 2
CodedDate = Replace(Cells(X, "A").Value, "<__", "....")
For Z = 1 To Len(CodedDate)
If Mid(CodedDate, Z, 1) = "L" Then
If Z And 1 Then
If Mid(CodedDate, Z + 1, 1) = "L" Then
Cells(X, Col).Value = (Z + 1) / 2
Else
Cells(X, Col).Value = ((Z + 1) / 2) & "(am)"
End If
Col = Col + 1
ElseIf Mid(CodedDate, Z - 1, 1) < "L" Then
Cells(X, Col).Value = (Z / 2) & "(pm)"
Col = Col + 1
End If
End If
Next
Next
End Sub

--
Rick (MVP - Excel)




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
replace part text in a cell Indra Excel Discussion (Misc queries) 3 December 8th 08 03:29 AM
Using Replace to remove part of a string [email protected] Excel Programming 5 August 18th 08 05:06 PM
Replace Part of a Function Walter Excel Worksheet Functions 2 April 23rd 08 04:07 PM
Replace Old Part Numbers with New Part Numbers in a Macro. Jeffery Keown Excel Discussion (Misc queries) 5 October 17th 06 03:45 PM
Replace first part of SS# with x's (XXXX-XX-9999) Jenpher Excel Programming 6 May 6th 04 05:02 AM


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