Please,
i need this function to return formula to cell...not the value but
the formula...
thanks a lot
Public Function fnMonth(i As Integer)
fnMonth = "=Podklady!B" & 114 + i
End Function
Please,
i need this function to return formula to cell...not the value but
the formula...
thanks a lot
Public Function fnMonth(i As Integer)
fnMonth = "=Podklady!B" & 114 + i
End Function
Can't do it, that is altering the cell and a function cannot do that. You
could try an event procedure.
'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "H1:H10"
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If IsNumeric(.Value) Then
.Formula = "=Podklady!B" & 114 + .Value
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
--
HTH
Bob Phillips
(remove nothere from email address if mailing direct)
"kontraa" <[email protected]> wrote in
message news:[email protected]...
>
> Please,
> i need this function to return formula to cell...not the value but
> the formula...
> thanks a lot
>
> Public Function fnMonth(i As Integer)
> fnMonth = "=Podklady!B" & 114 + i
> End Function
>
>
> --
> kontraa
> ------------------------------------------------------------------------
> kontraa's Profile:
http://www.excelforum.com/member.php...o&userid=33028
> View this thread: http://www.excelforum.com/showthread...hreadid=535859
>
kontraa,
Is this what you mean ?
In sheet1, range A1=GetFormula(5)
Public Function GetFormula(argOffset As Long) As String
With Sheet2.Range("A1")
GetFormula = .Offset(argOffset, 1).Formula
End With
End Function
But I suspect there are better way of achieving your goal.
NickHK
"kontraa" <[email protected]> wrote in
message news:[email protected]...
>
> Please,
> i need this function to return formula to cell...not the value but
> the formula...
> thanks a lot
>
> Public Function fnMonth(i As Integer)
> fnMonth = "=Podklady!B" & 114 + i
> End Function
>
>
> --
> kontraa
> ------------------------------------------------------------------------
> kontraa's Profile:
http://www.excelforum.com/member.php...o&userid=33028
> View this thread: http://www.excelforum.com/showthread...hreadid=535859
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks