I am looking for the code which will extract the string from right side of the worksheet name up to first space in entire string and paste it in cell B11.
Example of the string (worksheet name) : my sheet.1 - 31111111C --------> result in cell B11 should be 31111111C
for that I have code below and it works:
but if there is more than 9 digits from the right side up to the first space I have no idea.
but it doesnt work in that case
I need a code who will works for all casses, doesnt mater how many digits I will have from the right side up to first space.
Example of the string (worksheet name) : my sheet.1 - 31111111C --------> result in cell B11 should be 31111111C
for that I have code below and it works:
Code:
targetWorkbook.Worksheets(ii).Range("B11").value = Right(TargetSheet.name, 9)
but if there is more than 9 digits from the right side up to the first space I have no idea.
but it doesnt work in that case
Code:
targetWorkbook.Worksheets(ii).Range("B11").value = Right(TargetSheet.name, InStr(TargetSheet.name, " - "))
I need a code who will works for all casses, doesnt mater how many digits I will have from the right side up to first space.