Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

VBA 32-bit, (削除) 159 (削除ここまで) (削除) 157 (削除ここまで) (削除) 143 (削除ここまで) (削除) 141 (削除ここまで) 134 Bytes

VBA does not have a built in function that allows for waiting for time periods less than one second so we must declare a function from kernel32.dll

32 Bit Declare Statement (41 Bytes)

Declare Sub Sleep Lib"kernel32"(ByVal M&)

64 Bit Declare Statement (49 Bytes)

Declare PtrSafe Sub Sleep Lib"kernel32"(ByVal M&)

Additionally, we must include a DoEvents flag to avoid the infinite loop from making Excel appear as non-responsive. The final function is then a subroutine which takes no input and outputs to the VBE immediate window.

Immediate Window function, 93 Bytes

Anonymous VBE immediate window function that takes no input and outputs to the range A1 on the ActiveSheet

s="... .... .":Do:DoEvents:Sleep 100:[A1]="["&Mid(s,10-i,10)&"]":i=(i+1)Mod 10:Loop

Old Version, 109 Bytes

###Old Version, 109 Bytes ImmediateImmediate window function that takes no input and outputs to the VBE immediate window.

s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1) Mod 10:Loop

Ungolfted and formatted

Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal M&)
Sub a()
 Dim i As Integer, s As String
 s = "... .... ."
 i = 0
 Do
 Debug.Print [REPT(CHAR(10),99]; "["; Mid(s, 10 - i, 10); "]"
 DoEvents
 Sleep 100
 i = (i + 1) Mod 10
 Loop
End Sub

-2 Bytes for removing whitespace

-30 Bytes for counting correctly

-14 Bytes for converting to immediate window function

Output

The gif below uses the full subroutine version because I was too lazy to rerecord this with the immediate window function.

VBA loading Gif

VBA 32-bit, (削除) 159 (削除ここまで) (削除) 157 (削除ここまで) (削除) 143 (削除ここまで) (削除) 141 (削除ここまで) 134 Bytes

VBA does not have a built in function that allows for waiting for time periods less than one second so we must declare a function from kernel32.dll

32 Bit Declare Statement (41 Bytes)

Declare Sub Sleep Lib"kernel32"(ByVal M&)

64 Bit Declare Statement (49 Bytes)

Declare PtrSafe Sub Sleep Lib"kernel32"(ByVal M&)

Additionally, we must include a DoEvents flag to avoid the infinite loop from making Excel appear as non-responsive. The final function is then a subroutine which takes no input and outputs to the VBE immediate window.

Immediate Window function, 93 Bytes

Anonymous VBE immediate window function that takes no input and outputs to the range A1 on the ActiveSheet

s="... .... .":Do:DoEvents:Sleep 100:[A1]="["&Mid(s,10-i,10)&"]":i=(i+1)Mod 10:Loop

###Old Version, 109 Bytes Immediate window function that takes no input and outputs to the VBE immediate window.

s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1) Mod 10:Loop

Ungolfted and formatted

Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal M&)
Sub a()
 Dim i As Integer, s As String
 s = "... .... ."
 i = 0
 Do
 Debug.Print [REPT(CHAR(10),99]; "["; Mid(s, 10 - i, 10); "]"
 DoEvents
 Sleep 100
 i = (i + 1) Mod 10
 Loop
End Sub

-2 Bytes for removing whitespace

-30 Bytes for counting correctly

-14 Bytes for converting to immediate window function

Output

The gif below uses the full subroutine version because I was too lazy to rerecord this with the immediate window function.

VBA loading Gif

VBA 32-bit, (削除) 159 (削除ここまで) (削除) 157 (削除ここまで) (削除) 143 (削除ここまで) (削除) 141 (削除ここまで) 134 Bytes

VBA does not have a built in function that allows for waiting for time periods less than one second so we must declare a function from kernel32.dll

32 Bit Declare Statement (41 Bytes)

Declare Sub Sleep Lib"kernel32"(ByVal M&)

64 Bit Declare Statement (49 Bytes)

Declare PtrSafe Sub Sleep Lib"kernel32"(ByVal M&)

Additionally, we must include a DoEvents flag to avoid the infinite loop from making Excel appear as non-responsive. The final function is then a subroutine which takes no input and outputs to the VBE immediate window.

Immediate Window function, 93 Bytes

Anonymous VBE immediate window function that takes no input and outputs to the range A1 on the ActiveSheet

s="... .... .":Do:DoEvents:Sleep 100:[A1]="["&Mid(s,10-i,10)&"]":i=(i+1)Mod 10:Loop

Old Version, 109 Bytes

Immediate window function that takes no input and outputs to the VBE immediate window.

s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1) Mod 10:Loop

Ungolfted and formatted

Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal M&)
Sub a()
 Dim i As Integer, s As String
 s = "... .... ."
 i = 0
 Do
 Debug.Print [REPT(CHAR(10),99]; "["; Mid(s, 10 - i, 10); "]"
 DoEvents
 Sleep 100
 i = (i + 1) Mod 10
 Loop
End Sub

-2 Bytes for removing whitespace

-30 Bytes for counting correctly

-14 Bytes for converting to immediate window function

Output

The gif below uses the full subroutine version because I was too lazy to rerecord this with the immediate window function.

VBA loading Gif

added 17 characters in body
Source Link
Taylor Raine
  • 9k
  • 2
  • 29
  • 53

VBA 32-bit, (削除) 159 (削除ここまで) (削除) 157 (削除ここまで) (削除) 143 (削除ここまで)(削除) 141 (削除ここまで) 141134 Bytes

VBA does not have a built in function that allows for waiting for time periods less than one second so we must declare a function from kernel32.dll

32 Bit Declare Statement (41 Bytes)

Declare Sub Sleep Lib"kernel32"(ByVal M&)

64 Bit Declare Statement (49 Bytes)

Declare PtrSafe Sub Sleep Lib"kernel32"(ByVal M&)

Additionally, we must include a DoEvents flag to avoid the infinite loop from making Excel appear as non-responsive. The final function is then a subroutine which takes no input and outputs to the VBE immediate window.

Immediate Window function, 10093 Bytes

Anonymous VBE immediate window function that takes no input and outputs to the range A1 on the ActiveSheet

s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid[A1]="["&Mid(s,10-i,10)&"]":i=(i+1)Mod 10:Loop

Full Subroutine, 114 Bytes

Full subroutine version of the ###Old Version, 109 Bytes Immediate window function abovethat takes no input and outputs to the VBE immediate window.

Sub a:s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1) Mod 10:Loop:End Sub

Ungolfted and formatted

Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal M&)
Sub a()
 Dim i As Integer, s As String
 s = "... .... ."
 i = 0
 Do
 For j = 0 To 20
 Debug.Print vbLf
  Next
 Debug.Print "["[REPT(CHAR(10),99]; &"["; Mid(s, 10 - i, 10) &; "]"
 DoEvents
 Sleep 100
 i = (i + 1) Mod 10
 Loop
End Sub

-2 Bytes for removing whitespace

-30 Bytes for counting correctly

-14 Bytes for converting to immediate window function

Output

The gif below uses the full subroutine version because I was too lazy to rerecord this with the immediate window function.

VBA loading Gif

VBA 32-bit, (削除) 159 (削除ここまで) (削除) 157 (削除ここまで) (削除) 143 (削除ここまで) 141 Bytes

VBA does not have a built in function that allows for waiting for time periods less than one second so we must declare a function from kernel32.dll

32 Bit Declare Statement (41 Bytes)

Declare Sub Sleep Lib"kernel32"(ByVal M&)

64 Bit Declare Statement (49 Bytes)

Declare PtrSafe Sub Sleep Lib"kernel32"(ByVal M&)

Additionally, we must include a DoEvents flag to avoid the infinite loop from making Excel appear as non-responsive. The final function is then a subroutine which takes no input and outputs to the VBE immediate window.

Immediate Window function, 100 Bytes

Anonymous VBE immediate window function that takes no input

s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1)Mod 10:Loop

Full Subroutine, 114 Bytes

Full subroutine version of the function above

Sub a:s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1) Mod 10:Loop:End Sub

Ungolfted and formatted

Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal M&)
Sub a()
 Dim i As Integer, s As String
 s = "... .... ."
 i = 0
 Do
 For j = 0 To 20
 Debug.Print vbLf
  Next
 Debug.Print "[" & Mid(s, 10 - i, 10) & "]"
 DoEvents
 Sleep 100
 i = (i + 1) Mod 10
 Loop
End Sub

-2 Bytes for removing whitespace

-30 Bytes for counting correctly

-14 Bytes for converting to immediate window function

Output

The gif below uses the full subroutine version because I was too lazy to rerecord this with the immediate window function.

VBA loading Gif

VBA 32-bit, (削除) 159 (削除ここまで) (削除) 157 (削除ここまで) (削除) 143 (削除ここまで)(削除) 141 (削除ここまで) 134 Bytes

VBA does not have a built in function that allows for waiting for time periods less than one second so we must declare a function from kernel32.dll

32 Bit Declare Statement (41 Bytes)

Declare Sub Sleep Lib"kernel32"(ByVal M&)

64 Bit Declare Statement (49 Bytes)

Declare PtrSafe Sub Sleep Lib"kernel32"(ByVal M&)

Additionally, we must include a DoEvents flag to avoid the infinite loop from making Excel appear as non-responsive. The final function is then a subroutine which takes no input and outputs to the VBE immediate window.

Immediate Window function, 93 Bytes

Anonymous VBE immediate window function that takes no input and outputs to the range A1 on the ActiveSheet

s="... .... .":Do:DoEvents:Sleep 100:[A1]="["&Mid(s,10-i,10)&"]":i=(i+1)Mod 10:Loop

###Old Version, 109 Bytes Immediate window function that takes no input and outputs to the VBE immediate window.

s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1) Mod 10:Loop

Ungolfted and formatted

Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal M&)
Sub a()
 Dim i As Integer, s As String
 s = "... .... ."
 i = 0
 Do
 Debug.Print [REPT(CHAR(10),99]; "["; Mid(s, 10 - i, 10); "]"
 DoEvents
 Sleep 100
 i = (i + 1) Mod 10
 Loop
End Sub

-2 Bytes for removing whitespace

-30 Bytes for counting correctly

-14 Bytes for converting to immediate window function

Output

The gif below uses the full subroutine version because I was too lazy to rerecord this with the immediate window function.

VBA loading Gif

added 17 characters in body
Source Link
Taylor Raine
  • 9k
  • 2
  • 29
  • 53

VBA 32-bit, (削除) 159 (削除ここまで)(削除) 157 (削除ここまで) 143(削除) 159 (削除ここまで)(削除) 157 (削除ここまで)(削除) 143 (削除ここまで) 141 Bytes

VBA does not have a built in function that allows for waiting for time periods less than one second so we must declare a function from kernel32.dll

32 Bit Declare Statement (4341 Bytes)

Declare Sub Sleep Lib "kernel32" Lib"kernel32"(ByVal M&)

64 Bit Declare Statement (5149 Bytes)

Declare PtrSafe Sub Sleep Lib "kernel32" Lib"kernel32"(ByVal M&)

Additionally, we must include a DoEvents flag to avoid the infinite loop from making Excel appear as non-responsive. The final function is then a subroutine which takes no input and outputs to the VBE immediate window.

Immediate Window function, 100 Bytes

Anonymous VBE immediate window function that takes no input

s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1) Mod 10:Loop

Full Subroutine, 114 Bytes

Full subroutine version of the function above

Sub a:s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1) Mod 10:Loop:End Sub

Ungolfted and formatted

Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal M&)
Sub a()
 Dim i As Integer, s As String
 s = "... .... ."
 i = 0
 Do
 For j = 0 To 20
 Debug.Print vbLf
 Next
 Debug.Print "[" & Mid(s, 10 - i, 10) & "]"
 DoEvents
 Sleep 100
 i = (i + 1) Mod 10
 Loop
End Sub

-2 Bytes for removing whitespace

-30 Bytes for counting correctly

-14 Bytes for converting to immediate window function

Output

The gif below uses the full subroutine version because I was too lazy to rerecord this with the immediate window function.

VBA loading Gif

VBA 32-bit, (削除) 159 (削除ここまで)(削除) 157 (削除ここまで) 143 Bytes

VBA does not have a built in function that allows for waiting for time periods less than one second so we must declare a function from kernel32.dll

32 Bit Declare Statement (43 Bytes)

Declare Sub Sleep Lib "kernel32" (ByVal M&)

64 Bit Declare Statement (51 Bytes)

Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal M&)

Additionally, we must include a DoEvents flag to avoid the infinite loop from making Excel appear as non-responsive. The final function is then a subroutine which takes no input and outputs to the VBE immediate window.

Immediate Window function, 100 Bytes

Anonymous VBE immediate window function that takes no input

s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1) Mod 10:Loop

Full Subroutine, 114 Bytes

Full subroutine version of the function above

Sub a:s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1) Mod 10:Loop:End Sub

Ungolfted and formatted

Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal M&)
Sub a()
 Dim i As Integer, s As String
 s = "... .... ."
 i = 0
 Do
 For j = 0 To 20
 Debug.Print vbLf
 Next
 Debug.Print "[" & Mid(s, 10 - i, 10) & "]"
 DoEvents
 Sleep 100
 i = (i + 1) Mod 10
 Loop
End Sub

-2 Bytes for removing whitespace

-30 Bytes for counting correctly

-14 Bytes for converting to immediate window function

Output

The gif below uses the full subroutine version because I was too lazy to rerecord this with the immediate window function.

VBA loading Gif

VBA 32-bit, (削除) 159 (削除ここまで)(削除) 157 (削除ここまで)(削除) 143 (削除ここまで) 141 Bytes

VBA does not have a built in function that allows for waiting for time periods less than one second so we must declare a function from kernel32.dll

32 Bit Declare Statement (41 Bytes)

Declare Sub Sleep Lib"kernel32"(ByVal M&)

64 Bit Declare Statement (49 Bytes)

Declare PtrSafe Sub Sleep Lib"kernel32"(ByVal M&)

Additionally, we must include a DoEvents flag to avoid the infinite loop from making Excel appear as non-responsive. The final function is then a subroutine which takes no input and outputs to the VBE immediate window.

Immediate Window function, 100 Bytes

Anonymous VBE immediate window function that takes no input

s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1) Mod 10:Loop

Full Subroutine, 114 Bytes

Full subroutine version of the function above

Sub a:s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1) Mod 10:Loop:End Sub

Ungolfted and formatted

Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal M&)
Sub a()
 Dim i As Integer, s As String
 s = "... .... ."
 i = 0
 Do
 For j = 0 To 20
 Debug.Print vbLf
 Next
 Debug.Print "[" & Mid(s, 10 - i, 10) & "]"
 DoEvents
 Sleep 100
 i = (i + 1) Mod 10
 Loop
End Sub

-2 Bytes for removing whitespace

-30 Bytes for counting correctly

-14 Bytes for converting to immediate window function

Output

The gif below uses the full subroutine version because I was too lazy to rerecord this with the immediate window function.

VBA loading Gif

Corrected Typo
Source Link
Taylor Raine
  • 9k
  • 2
  • 29
  • 53
Loading
Many Corrections
Source Link
Taylor Raine
  • 9k
  • 2
  • 29
  • 53
Loading
Removed whitespace
Source Link
Taylor Raine
  • 9k
  • 2
  • 29
  • 53
Loading
count for 64-Bit
Source Link
Taylor Raine
  • 9k
  • 2
  • 29
  • 53
Loading
Corrected lack of screen clearing
Source Link
Taylor Raine
  • 9k
  • 2
  • 29
  • 53
Loading
bytecount clarification (64 Bit)\
Source Link
Taylor Raine
  • 9k
  • 2
  • 29
  • 53
Loading
added 64 bit declare statement
Source Link
Taylor Raine
  • 9k
  • 2
  • 29
  • 53
Loading
Source Link
Taylor Raine
  • 9k
  • 2
  • 29
  • 53
Loading

AltStyle によって変換されたページ (->オリジナル) /