I have a function and I want it to output one word in the current cell and one in the cell to the right (i.e., the next column). Is there a way to write this in VB?

So, something along these lines (though this doesn't work):

Function test(word1 As String, word2 As String)
test = word1
test.Offset(0, 1) = word2
End Function

This also doesn't work:

Function test3(word1 As String, word2 As String)
ActiveCell = word1
ActiveCell.Offset(0, 1) = word2
End Function

I suppose the general version of my question is how can I output an item in a cell other than the one the function is called from?

Thanks!

Try something like:
ActiveCell.FormulaR1C1 = "firstname"
Cells(ActiveCell.Row, ActiveCell.Column + 1) = "surname"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.