Dear VB Members,
I have got this problem,
I trying to sort out from the sheetname Companyname,Year,Month
The name is always written:
xxxxxxx_xxxx_xx
example
COMPANY_2015-05
I have made an array to try to filter the parts of the things.
by using these variables I can grep the parts of the name
see code below:
The problem is, when I can alert the last part of the combination (month)
I always recieve if there is a lower value than 10 I get 05.
so I need to delete the leading zero to get value "5"
Then I want to convert the number to the month number 5
so I recieve in a messagebox in this case (may)
Could someone help me out with a code?
Thank you in advance all VB Members
Cheers
I have got this problem,
I trying to sort out from the sheetname Companyname,Year,Month
The name is always written:
xxxxxxx_xxxx_xx
example
COMPANY_2015-05
I have made an array to try to filter the parts of the things.
by using these variables I can grep the parts of the name
see code below:
Code:
sub mytest()
For Each sht In ThisWorkbook.Worksheets
mysheetname = sht.Name
If sht.Name Like "Volvo Penta*" Then
Myarr = Split(mysheetname, "_") ' seperate all words
myCompany = Myarr(0)
myyearandMonth = Myarr(1)
myyear = Left(myyearandMonth, 4)
mymonth = Right(myyearandMonth, 2)
For i = 2 To ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row
' I put all my code in here
Next i
End If
Next sht
end sub
The problem is, when I can alert the last part of the combination (month)
I always recieve if there is a lower value than 10 I get 05.
so I need to delete the leading zero to get value "5"
Then I want to convert the number to the month number 5
so I recieve in a messagebox in this case (may)
Could someone help me out with a code?
Thank you in advance all VB Members
Cheers