View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Arnold Klapheck Arnold Klapheck is offline
external usenet poster
 
Posts: 42
Default sending parameter of another cell value

currently am using code:

Dim intMaterial As Integer
Dim strMaterial As String
strMaterial = ActiveCell.Offset([0], [-15])
intMaterial = ConvertMaterial(strMaterial)

the above works, but was going to try to reduce by two lines to:

Dim intMaterial As Integer
intMaterial = ConvertMaterial(ActiveCell.Offset(0, -15)) 'runtime error
1004 object defined error
-or-
Dim intMaterial As Integer
intMaterial = ConvertMaterial(ActiveCell.Offset(0, -15).Address(0,0))
'returns cell reference, not value
-or-
Dim intMaterial As Integer
intMaterial = ConvertMaterial(ActiveCell.Offset(0, -15).value) 'runtime
error 1004 object defined error

ConvertMaterial is my own function that takes in a string and returns an int.
Any ideas how to do this? thanx