Copying Part of a String

Copying Part of a String

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.

This is easy to do using the InStr function and the Left function:

Dim strFilenameDim strPortionstrFilename = "100dpi.txt"strPortion = Left(strFilename, InStr(strFilename, ".") - 1)
See also  5 Tips to Manage a Remote Workforce

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist