For example, use CCur to force currency arithmetic in cases where single-precision, double-precision, or integer arithmetic normally would occur. In general, you can document your code using the data-type conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. Implicit conversions of LongLong to smaller integrals are not allowed. If the expression passed to the function is outside the range of the data type being converted to, an error occurs.Ĭonversion functions must be used to explicitly assign LongLong (including LongPtr on 64-bit platforms) to smaller integral types. Returns for CStr depend on the expression argument. The function name determines the return type as shown in the following: Function The required expression argument is any string expression or numeric expression. CLngLng( expression ) (Valid on 64-bit platforms only.).So if for example you write the formula in Sheet2 in any cell something like this =test(Sheet1!D1,Sheet1!G2:G16,"test",Sheet1!H2:I16), it still give a correct result.īut that's if I understand you correctly.Each function coerces an expression to a specific data type. Please note, the function assumed that all the data is in Sheet1. But if the change is about the color, it won't recalculate. If found, then it check interior colos is lCol.Īs seen in the animation above, the formula recalculate if there is a change within rCondRange. The function loop to each row of rCondRange, then check if it find the value of StrCond in the looped row. Interior.Color = lCol Then cnt = cnt + 1 If Sheets("Sheet1").Cells(r.Row, rColoredRange.Column) _ If Not r.Find(StrCond, lookat:=xlWhole) Is Nothing Then Function test(rColor As Range, rColoredRange As Range, StrCond As String, rCondRange As Range) As Long If Cells(rColoredCell.Row, i).Value = StrCond Then I did find this, an exchange between Algo and Shai Rado but it doesn't seem to work: Function ConditionalColorFunction(rColor As Range, rColoredRange As Range, StrCond As String, rCondRange As Range) As Long I found something that will almost do it but the VBA looks for words and colours in the same range. I've found VBA to count cells by colour but I want to extend this so that I only count the colour when a certain word appears in another range. I'm trying to find some VBA to count cells by colour in a range when there is specific word in an adjacent range.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |