简体   繁体   中英

Fixing a syntax error of a mid function in VBA?

I'm working in VBA excel and I'm trying to write a mid function but I keep getting a syntax error and I can't figure it out.

Here's the code:

Mid=("RXOTRX", "8", "7");

If you're trying to use the VBA Mid function, then your code should look something like this:

MidValue = Mid("RXOTRX", 8, 7)

Note that in your example, the start position would be past the end of your search string "RXOTRX" so it would return a zero-length string ( "" ).

Additional documentation about the Mid function can be found here: http://msdn.microsoft.com/en-us/library/05e63829(v=vs.90).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM