VBA/Excel How to save ActiveCell as object
<p>i need to build login text from a list in Excel. I try myself with macro and write a small script. basically i have 2 cell one next to the other. the first one get a ssh key name, and the second get the passphrase. this 2 value depend on the os of the machine, specified in an other field. Final i have a table with the os name, and the ssh key next to the passphrase.</p>

<p>this is what i wrote :</p>

<pre><code>Function FindKey(FirstCell As Range) As String
'
' FindKey Macro
' Find the ssh key in function of the OS
'
Dim Find As Boolean
Dim Cell As Range
Dim OS As String


Cell = ActiveCell.Address
ActiveCell.Offset(0, 4).Value = OS
Find = False
While Not Find
    ActiveCell = FirstCell.Address
    If ActiveCell.Value = OS Then
        FindKey = ActiveCell.Offset(0, 1).Value
        Cell.Offset(0, 1).Value = ActiveCell.Offset(0, 2).Value
        Cell.Select
        Find = True
    Else
        ActiveCell.Offset(1, 0).Select
        If IsEmpty(ActiveCell) Then
            Cell.Select
            FindKey = CVErr(xlErrNull)
            Find = True
        End If
    End If

Wend
'
End Function
</code></pre>

<p>I truly have no idea of how I'm suppose to write that. Can i only store cell address in a variable ? can i use it as a object next ?</p>

<p>Thank you for your time and have a nice day</p>