Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
in VBA Excel
Function GetText() As String Dim Str1 As String For Row = 51 To 74 Str1 = Str1 & Cells(Row, 3).Text Next Row GetText = Str1 End Function in worksheet cell C77 contains =gettext() Now when any row 51 to 74 and column 3 changes my function gettext does not update. Could some explain to me why and what I should do to fix it Thanks, |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Since you don't have the range in your function's arguments, XL has no
way of knowing that cells C51 or C74 have anything to do with your function. You could force the function to calculate every time the sheet calculates by including Application.Volatile at the top of your macro. Better, you could put the range in your function's arguments: Public Function GetText(byRef rng As Excel.Range) As String Dim rCell As Range Dim sTemp As String For Each rCell in rng sTemp = sTemp & rCell.Text Next rCell GetText = sTemp End Function Then C77: =GetText(C51:C74) In article .com, wrote: in VBA Excel Function GetText() As String Dim Str1 As String For Row = 51 To 74 Str1 = Str1 & Cells(Row, 3).Text Next Row GetText = Str1 End Function in worksheet cell C77 contains =gettext() Now when any row 51 to 74 and column 3 changes my function gettext does not update. Could some explain to me why and what I should do to fix it Thanks, |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Make it volatile.
Function GetText() As String Application.Volatile True Dim Str1 As String For Row = 51 To 74 Str1 = Str1 & Cells(Row, 3).Text Next Row GetText = Str1 End Function Gord Dibben MS Excel MVP On 27 Apr 2007 14:03:08 -0700, wrote: in VBA Excel Function GetText() As String Dim Str1 As String For Row = 51 To 74 Str1 = Str1 & Cells(Row, 3).Text Next Row GetText = Str1 End Function in worksheet cell C77 contains =gettext() Now when any row 51 to 74 and column 3 changes my function gettext does not update. Could some explain to me why and what I should do to fix it Thanks, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Why won't th unhide function work?? | Excel Discussion (Misc queries) | |||
NETWORKDAYS Function doesn't work | Excel Worksheet Functions | |||
how do i get the mid function to work with a zero | Excel Worksheet Functions | |||
Which excel function would work best? | Excel Worksheet Functions | |||
Why doesn't my =RANDBETWEEN function work? | Excel Discussion (Misc queries) |