Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This could work, I wasn't sure what order you have your data in your cells so
I'm presuming they're all just down on colum, but you can change to suit your needs. I'm sure there will be a better way, but this should work (not had chance to test it) Option Explicit Public Sub loopAndFindMonths() size = Sheets("SheetName").Cells(Rows.Count, "A").Row Dim i As Long For i = 1 To size splitUpString Sheets("SheetName").Cells(i, 1).Value, i Next i End Sub Private Sub splitUpString(str As String, rowAt As Long) Dim splitString() As String splitString = split(str, " ") Dim i As Integer For i = 0 To UBound(splitString) If CheckIsMonth(Mid(splitString(i), 1, 3)) Then Sheets("SheetName").Cells(rowAt, 2).Value = Mid(splitString(i), 1, 3) End If Next i End Sub Private Function CheckIsMonth(str As String) As Boolean str = UCase(str) Select Case str Case "JAN" CheckIsMonth = True Case "FEB" CheckIsMonth = True Case "MAR" CheckIsMonth = True Case Else CheckIsMonth = False End Select End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extract Month From A Text String | Excel Discussion (Misc queries) | |||
Looking for a Month Name in a String | Excel Programming | |||
Convert month number to string | Excel Worksheet Functions | |||
copy worksheet from previous month and rename to current month | Excel Programming | |||
Lookup the month in a date string 01/03/05 | Excel Worksheet Functions |