![](https://s.togetter.com/static/web/img/placeholder.gif)
[ノンプロ研]VBA初心者講座5期第3回・プロシージャ・関数
『コミュニティ「ノンプログラマーのためのスキルアップ研究会」VBA コース第5期第3回のツイートまとめです。コンテンツは「プロシージャ・関数」です。
https://tonari-it.com/community-nonpro-semi/』
![](https://s.togetter.com/static/web/img/placeholder.gif)
戻り値があるのが関数 戻り値ないのがサブプロシージャ VBAはややこしいな #ノンプロ研 #VBA初心者講座
2021-11-22 20:46:54![](https://s.togetter.com/static/web/img/placeholder.gif)
関数とは戻り値を持つプロシージャー。 Function Procedure 戻り値を持たないのが、Sub Procedure. #ノンプロ研 #VBA初心者講座
2021-11-22 20:47:01![](https://s.togetter.com/static/web/img/placeholder.gif)
functionは最終的な結果をプロシージャ名に代入してあげるイメージ なので、()の後に 何かを宣言するものを書かなければいけない。 #ノンプロ研
2021-11-22 20:50:19![](https://s.togetter.com/static/web/img/placeholder.gif)
なにかを渡して、ナニカを返すものが関数ですよね y=f(x) と同じ #ノンプロ研 #エア初級VBA twitter.com/workinprocess6…
2021-11-22 20:53:58![](https://s.togetter.com/static/web/img/placeholder.gif)
さっきのSquareだとDebug.Printで値を返していたけど、単純な数式ならFunctionプロシージャは使わない方が楽? #ノンプロ研 #VBA初心者講座
2021-11-22 20:54:11![](https://s.togetter.com/static/web/img/placeholder.gif)
#ノンプロ研 #VBA初心者講座 GASの場合は、returnの後は実行されない。 VBAは、returnの後も、実行され続ける。
2021-11-22 20:57:07![](https://s.togetter.com/static/web/img/placeholder.gif)
#ノンプロ研 #VBA初心者講座 まずはsubプロシージャと、functionプロシージャをマスターしよう。戻り値ほしい→function, 戻り値いらない→sub。みんなと同じ書き方をするのは、可読性があがるということ。自分ルール不要。
2021-11-22 21:00:25![](https://s.togetter.com/static/web/img/placeholder.gif)
“Call” が無いと()の意味は変わります。 自動で入る半角スペースに要注意。 引数を()に入れるときは必ずCallを忘れずにね〜 #ノンプロ研 #エア初級VBA twitter.com/vicky_kmk/stat…
2021-11-22 21:01:07![](https://s.togetter.com/static/web/img/placeholder.gif)
#ノンプロ研 #VBA初心者講座 VBA関数は、VBAライブラリに入ってる。 Excelにも、Wordにも、PowerPointでも使えるよ。
2021-11-22 21:01:56