J
James Cornthwaite
So then using comments to mark accessed cells (as this is the only option
with functions since they are not able to modifying cell formats in other
ways)
Function FindOldNominal(NomCode, definedRange)
FindOldNominal = WorksheetFunction.VLookup(NomCode, definedRange, 5, False)
'(now attempt to mark the accessed cell - the bit not yet working!!!!)
Dim rng As Range
Dim noOfRows As Integer
noOfRows = Match(NomCode, definedRange, 0)
rng = Offset(A1, noOfRows, 0, 1, 1)
rng.AddComment ("accesses")
EndFunction
I realise the above is probably incorrect syntax, but have only just started
to learn macro and excel functions (not even sure functions are found in
what classes etc).
Please could you ammend the above so it works. Hopefully the gist of what
i'm trying is clearer enough.
Many many thanks in anticipation
James
PREVIOUS POST
""Gary replied..............
A function can deposit comments in cells:
Function demo(r As Range) As Integer
demo = 1
If r.Comment Is Nothing Then
Else
r.Comment.Delete
End If
r.AddComment Text:="marked"
End Function
This dumb little macro just returns 1, but it marks its reference with a
comment
=demo(A1) results in A1 getting a comment. So even if you can't color A1,
you can mark it.
with functions since they are not able to modifying cell formats in other
ways)
Function FindOldNominal(NomCode, definedRange)
FindOldNominal = WorksheetFunction.VLookup(NomCode, definedRange, 5, False)
'(now attempt to mark the accessed cell - the bit not yet working!!!!)
Dim rng As Range
Dim noOfRows As Integer
noOfRows = Match(NomCode, definedRange, 0)
rng = Offset(A1, noOfRows, 0, 1, 1)
rng.AddComment ("accesses")
EndFunction
I realise the above is probably incorrect syntax, but have only just started
to learn macro and excel functions (not even sure functions are found in
what classes etc).
Please could you ammend the above so it works. Hopefully the gist of what
i'm trying is clearer enough.
Many many thanks in anticipation
James
PREVIOUS POST
""Gary replied..............
A function can deposit comments in cells:
Function demo(r As Range) As Integer
demo = 1
If r.Comment Is Nothing Then
Else
r.Comment.Delete
End If
r.AddComment Text:="marked"
End Function
This dumb little macro just returns 1, but it marks its reference with a
comment
=demo(A1) results in A1 getting a comment. So even if you can't color A1,
you can mark it.