LoginSignup
0
0

Excel VBA,マクロ セルへ書き出し

Posted at

やってみたシリーズ Excel
いつものごとく報告。

スクリーンショット 2024-06-05 180839.png
最初
スクリーンショット 2024-06-05 181213.png
イメージ1クリック
スクリーンショット 2024-06-05 181344.png
マクロ起動・1最終
スクリーンショット 2024-06-05 181438.png
マクロ2起動・最終
スクリーンショット 2024-06-05 181900.png
オブジェクト、ツリー
スクリーンショット 2024-06-05 181647.png
ソース

Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
' REM  *****  BASIC  *****
Sub Main
MsgBox "Hello"
Dim me_hello As String
me_hello = "Welcome "
MsgBox "Hello " & me_hello
Worksheets("Sheet1").Activate  'it ok.
Dim me_it As String
me_it = Range("B1").Value
MsgBox "Hello " & me_hello & me_it & " it World!"

	 Dim my_Seet_11 As Integer
     On Error GoTo age_error
	 	my_Seet_11 = Range("B2").Value
	 
	If my_Seet_11 < 20 Then
		Range("C3").Value = "Yangu"
	ElseIf my_Seet_11 < 55 Then
		Range("C3").Value = "Midol"
	Else
		Range("C3").Value = "Beteran"
	End If	
	 Range("A3").Value = "Welcome"
	 Range("B3").Value = me_it

  	GoTo me_end
  	age_error:
		MsgBox "数字でお願いします。"
		 Range("B2").Value = 10
  	me_end:
		'It end		
End Sub


Sub Macro1

	 MsgBox "it ok !!"
	 Range("A3").Value = ""
	 Range("B3").Value = ""
	 Range("C3").Value = "under stand!"

End Sub

Sub Macro2

End Sub

この中の IntegerにStringを代入してError検査をするところが、Error発生がありません。
On Error GoTo age_error
my_Seet_11 = Range("B2").Value
後は、過去の報告の繰り返しになる操作なので、記載は省略しました。

以上、よろしくお願いいたします。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0