spencer_time
Board Regular
- Joined
- Sep 19, 2019
- Messages
- 55
- Office Version
- 365
- 2016
- 2007
- Platform
- Windows
Hello,
I -had- part of my program working until I realized that the length of the filename wasn't always constant and I need help fixing that.
In the following section of code it used to look for a sheet names *CEQ* and extract the two numbers before CEQ and the two numbers after CEQ. I then started trying to make it more universal to work in my final application and swapped CEQ for the variable "response" (which gets its value from a user form and can be 1-6 characters, all letters) but then my MID functions to extract the 2 (maybe occasionally 3) numbers before and after the response variable will no longer work.
Is there a way to make the program not care if the sheet name is 105CEQ33 or 08CEQ4, and always extract the number before and the number after the the letters and save them into separate variables?
Thanks in advance.
I -had- part of my program working until I realized that the length of the filename wasn't always constant and I need help fixing that.
In the following section of code it used to look for a sheet names *CEQ* and extract the two numbers before CEQ and the two numbers after CEQ. I then started trying to make it more universal to work in my final application and swapped CEQ for the variable "response" (which gets its value from a user form and can be 1-6 characters, all letters) but then my MID functions to extract the 2 (maybe occasionally 3) numbers before and after the response variable will no longer work.
Code:
If curSheet.Name Like "*" & response & "*" Then
partNum = Mid(curSheet.Name, 1, 2) 'extract part number from filename to use in specifying where to save other information into array
dataSet(3, 0, partNum, designator) = Mid(curSheet.Name, 6) 'extract dB value from filename and save to dataset array
dataSet(9, 0, partNum, designator) = Mid(curSheet.Name, 1, 2) 'extract part number from filename and save to dataset array
Is there a way to make the program not care if the sheet name is 105CEQ33 or 08CEQ4, and always extract the number before and the number after the the letters and save them into separate variables?
Thanks in advance.