function call paramater question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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]))

ConvertMaterial is my own function that takes in a string and returns an int.
Any ideas how to do this
 
first, drop the square brackets. they add nothing but extra work.
You could change your function to accept a range.

or you could do

Dim intMaterial As Integer
intMaterial = ConvertMaterial(ActiveCell.Offset(0, -15).Address(0,0))
 
This returns the cell reference, in this case B2, what I want is the value in
the cell, AL, a string. any ideas?

:

you could do
 
Dim intMaterial As Integer
intMaterial = ConvertMaterial(ActiveCell.Offset(0, -15).Value)


then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top