Attribute VB_Name = "Module1" Function SolunYlapuolella(ByVal R As Long, ByVal S As Long) As String If R = 1 Then OutS = "Yläpuolella: N/A" Else OutS = "Yläpuolella: " & Cells(R - 1, S).Address End If SolunYlapuolella = OutS End Function Function SolunAlapuolella(ByVal R As Long, ByVal S As Long) As String If R = ThisWorkbook.ActiveSheet.Rows.Count Then OutS = "Alapuolella: N/A" Else OutS = "Alapuolella: " & Cells(R + 1, S).Address End If SolunAlapuolella = OutS End Function Function SolunVasemmallapuolella(ByVal R As Long, ByVal S As Long) As String If S = 1 Then OutS = "Vasemmalla: N/A" Else OutS = "Vasemmalla: " & Cells(R, S - 1).Address End If SolunVasemmallapuolella = OutS End Function Function SolunOikeallapuolella(ByVal R As Long, ByVal S As Long) As String If S = ThisWorkbook.ActiveSheet.Columns.Count Then OutS = "Oikealla: N/A" Else OutS = "Oikealla: " & Cells(R, S + 1).Address End If SolunOikeallapuolella = OutS End Function Sub SolunNaapurit() Attribute SolunNaapurit.VB_ProcData.VB_Invoke_Func = " \n14" Dim AktR As Long Dim AktS As Long Dim OutS As String OutS = "" AktR = ActiveCell.Row AktS = ActiveCell.Column OutS = SolunYlapuolella(AktR, AktS) & Chr(10) & _ SolunVasemmallapuolella(AktR, AktS) & Chr(10) & _ SolunOikeallapuolella(AktR, AktS) & Chr(10) & _ SolunAlapuolella(AktR, AktS) MsgBox OutS End Sub Sub SolunNaapuritLyhyt() MsgBox (SolunYlapuolella(ActiveCell.Row, ActiveCell.Column) & Chr(10) & _ SolunVasemmallapuolella(ActiveCell.Row, ActiveCell.Column) & Chr(10) & _ SolunOikeallapuolella(ActiveCell.Row, ActiveCell.Column) & Chr(10) & _ SolunAlapuolella(ActiveCell.Row, ActiveCell.Column)) End Sub