Mid Function, Mid Statement

āĻāĻ•āϟāĻŋ āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚ āĻāĻ•ā§āϏāĻĒā§āϰ⧇āĻļāύ⧇āϰ āωāĻ˛ā§āϞ⧇āĻ–āĻŋāϤ āĻ…āĻ‚āĻļ āĻĒā§āϰāĻĻāĻžāύ āĻ•āϰ⧇ āĻĨāĻžāϕ⧇ (āĻŽāĻ§ā§āϝāĻŦāĻ°ā§āϤ⧀ āĻĢāĻžāĻ‚āĻļāύ), āĻ…āĻĨāĻŦāĻž āĻ…āĻ¨ā§āϝ āĻāĻ•āϟāĻŋ āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚ āĻāϰ āĻŽāĻžāĻ§ā§āϝāĻŽā§‡ āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚āϟāĻŋāϰ āĻ…āĻ‚āĻļ āĻĒā§āϰāϤāĻŋāĻ¸ā§āĻĨāĻžāĻĒāύ āĻ•āϰ⧇ āĻĨāĻžāϕ⧇ (āĻŽāĻ§ā§āϝāĻŦāĻ°ā§āϤ⧀ āĻ¸ā§āĻŸā§‡āϟāĻŽā§‡āĻ¨ā§āϟ )āĨ¤

Syntax:


Mid (Text As String, Start As Long [, Length As Long]) or Mid (Text As String, Start As Long , Length As Long, Text As String)

Return value:

String (only by Function)

Parameters:

āϞ⧇āĻ–: āϝ⧇āϕ⧋āύ⧋ āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚ āĻāĻ•ā§āϏāĻĒā§āϰ⧇āĻļāύ āϝāĻž āφāĻĒāύāĻŋ āĻĒāϰāĻŋāĻŦāĻ°ā§āϤāύ āĻ•āϰāϤ⧇ āϚāĻžāύāĨ¤

Start: Numeric expression that indicates the character position within the string where the string portion that you want to replace or to return begins. The minimum allowed value is 1. The maximum allowed value is 2,147,483,648.

Length: Numeric expression that returns the number of characters that you want to replace or return. The maximum allowed value is 2,147,483,648.

āϝāĻĻāĻŋ āĻŽāĻ§ā§āϝāĻŦāĻ°ā§āϤ⧀ āĻĢāĻžāĻ‚āĻļāύ āĻāϰ āĻĻ⧈āĻ°ā§āĻ˜ā§āϝ āĻĒā§āϝāĻžāϰāĻžāĻŽāĻŋāϟāĻžāϰ āĻŦāĻžāĻĻ āĻĻā§‡ā§ŸāĻž āĻšāϝāĻŧ āϤāĻžāĻšāϞ⧇ āĻˇā§āĻŸā§āϰāĻŋāĻ‚ āĻāĻ•ā§āϏāĻĒā§āϰ⧇āĻļāύāϰ āĻļ⧁āϰ⧁āϰ āĻ…āĻŦāĻ¸ā§āĻĨāĻžāύ āĻĨ⧇āϕ⧇ āĻˇā§āĻŸā§āϰāĻŋāĻ‚ āĻāϰ āĻļ⧇āώ āĻĒāĻ°ā§āϝāĻ¨ā§āϤ āϏāĻŦ āĻ…āĻ•ā§āώāϰ āĻĒā§āϰāĻĻāĻžāύ āĻ•āϰāĻž āĻšā§ŸāĨ¤

āφāĻĒāύāĻŋ āϝ⧇ āĻĒāĻžāĻ ā§āϝāϟāĻŋ āĻĒā§āϰāϤāĻŋāĻ¸ā§āĻĨāĻžāĻĒāύ āĻ•āϰāϤ⧇ āϚāĻžāύ āϤāĻžāϰ āĻĻ⧈āĻ°ā§āĻ˜ā§āϝ āϝāĻĻāĻŋ āĻŽāĻ§ā§āϝāĻŦāĻ°ā§āϤ⧀ āĻ¸ā§āĻŸā§‡āϟāĻŽā§‡āĻ¨ā§āϟ āĻāϰ āĻĻ⧈āĻ°ā§āĻ˜ā§āϝ āĻĒā§āϝāĻžāϰāĻžāĻŽāĻŋāϟāĻžāϰ āĻšā§‡ā§Ÿā§‡ āĻŦ⧜ āĻšā§Ÿ āϤāĻžāĻšāϞ⧇ āĻĒāĻžāĻ ā§āϝāϟāĻŋ āωāĻ˛ā§āϞ⧇āĻ–āĻŋāϤ āĻĻ⧈āĻ°ā§āĻ˜ā§āϝ⧇ āĻšā§āϰāĻžāϏ āĻĒāĻžā§ŸāĨ¤

āĻĒāĻžāĻ ā§āϝ: āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚ āĻāĻ•ā§āϏāĻĒā§āϰ⧇āĻļāύ āĻĒā§āϰāϤāĻŋāĻ¸ā§āĻĨāĻžāĻĒāύ āĻ•āϰāϤ⧇ āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚ ( āĻŽāĻ§ā§āϝāĻŦāĻ°ā§āϤ⧀ āĻ¸ā§āĻŸā§‡āϟāĻŽā§‡āĻ¨ā§āϟ)āĨ¤

Error codes:

5 Invalid procedure call

Example:


Sub ExampleUSDate
Dim sInput As String
Dim sUS_date As String
    sInput = InputBox("Please input a date in the international format 'YYYY-MM-DD'")
    sUS_date = Mid(sInput, 6, 2)
    sUS_date = sUS_date & "/"
    sUS_date = sUS_date & Right(sInput, 2)
    sUS_date = sUS_date & "/"
    sUS_date = sUS_date & Left(sInput, 4)
    MsgBox sUS_date
End Sub

Please support us!