Question:
I have a little problem which I can’t solve. I will give the question with an example.
I’m working with Excel. In a cell the string “100dpi.txt” is written. Is it possible to copy a part of this string “100dpi” to another cell? How should I do this? In this example the “part of the string” contains six characters before the dot. This part of the string can vary from one to eight characters.
Answer:
This is easy to do using the InStr function and the Left function:
Dim strFilenameDim strPortionstrFilename = "100dpi.txt"strPortion = Left(strFilename, InStr(strFilename, ".") - 1)