Tylerthigpen!1!
02-11-2010, 01:46 AM
Ugh it's the most basic code and I'm having problems. Basically writing a macro to convert kilograms (B2) to newtons (B4). Anybody care to look over my 4 lines of code? I'm getting a sub of function not defined error. It highlights sub weight. This is for my engineering class.
Option Explicit
Dim M As Double 'Creates M, Mass in kilograms
Dim W As Double 'Creates w, Weight in Newtons
Sub Weight() ' Start
'Input M
M = Rang("B2").Value
'Calculate W
W = 9.8 * M
'Output W
Rang("B4").Value = W
End Sub ' End
Option Explicit
Dim M As Double 'Creates M, Mass in kilograms
Dim W As Double 'Creates w, Weight in Newtons
Sub Weight() ' Start
'Input M
M = Rang("B2").Value
'Calculate W
W = 9.8 * M
'Output W
Rang("B4").Value = W
End Sub ' End