Obtaining the first seven characters of a text cell

M

Michael McClellan

I am trying to obtain the first seven characters of text in a given cell
in excel using VBA.

i.e. - a cell contains the text HMA4178A. I want to pass the HMA4178 to
a variable in VBA to be used with the dir statement.

Does anyone have any idea?


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
M

Martin Los

strResult =Left(Cell reference or Text String, 7) would do
the trick!

Martin
-----Original Message-----
Hi, try using this function
=Right([Cell Reference or Text String],7)

-----Original Message-----

I am trying to obtain the first seven characters of text in a given cell
in excel using VBA.

i.e. - a cell contains the text HMA4178A. I want to pass the HMA4178 to
a variable in VBA to be used with the dir statement.

Does anyone have any idea?


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top