ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extract Characters (https://www.excelbanter.com/excel-programming/308120-extract-characters.html)

Jack S[_2_]

Extract Characters
 

I am trying to Extract characters out of a string and
include them in a file name by using

Dim sName As String
sName = (Left(B1, 3) & Right(B1, 2))

But this does not work.

Any ideas as to what is wrong?

Thanks



Stephen Rasey[_2_]

Extract Characters
 
sName = (Left(range("B1"), 3) & Right(range("B1"), 2))

or better:

Function sName (rngS as range) as string 'or variant
Dim sName As String
sName = (Left(rngS, 3) & Right(rngS, 2))
end Function

Stephen Rasey
Houston
http://excelsig.org
http://wiserways.com


"Jack S" wrote in message
...

I am trying to Extract characters out of a string and
include them in a file name by using

Dim sName As String
sName = (Left(B1, 3) & Right(B1, 2))

But this does not work.

Any ideas as to what is wrong?

Thanks





No Name

Extract Characters
 

-----Original Message-----
sName = (Left(range("B1"), 3) & Right(range("B1"), 2))

or better:

Function sName (rngS as range) as

string 'or variant
Dim sName As String
sName = (Left(rngS, 3) & Right(rngS, 2))
end Function

Stephen Rasey
Houston
http://excelsig.org
http://wiserways.com


"Jack S" wrote in

message
...

I am trying to Extract characters out of a string and
include them in a file name by using

Dim sName As String
sName = (Left(B1, 3) & Right(B1, 2))

But this does not work.

Any ideas as to what is wrong?

Thanks




.
Thanks for your help.



All times are GMT +1. The time now is 05:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com