Hello All,
I've been wondering for a while how to display information regarding my formula within the cell. I don't know how to explain it, so I will just show you pictures. The one marked "What I want the formula to look like.bmp" contains text below the formula displaying what the formula can take. The other attachment is the call of my function, which does not have that extra text. Is is possible to make home made formulas display that extra text?
Here is my code, if it makes a difference. (I know I could have done the same thing with an OR instead of an Elseif...)
Public Function combine(data1 As Range, data2 As Range) as string
If data1 <> "" Then ‘ If something is contained within the first cell
combine = data1 & " - " & data2 ‘ Return the combination
ElseIf data2 <> "" Then ‘ If something is not in the first cell, but in the second
combine = data1 & " - " & data2 ‘ Return the combination
Else ‘ If data is not in anything, return a space
combine = " "
End If
End Function
Welcome to the forum.
Why not just use a formula?
Please take a few minutes to read the forum rules, and then edit your post to add code tags.-A- -B- ----C---- ---------------------------D-------------------------- 1 Bob Joe Bob - Joe C1 and down: =A1 & IF(COUNTA(A1,B1)=2, " - ", "") & B1 2 Bob Bob 3 Joe Joe
Thanks.
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
I could do this a lot of different ways, the function is just an example. Once I know how to do display the text, I can use it for all of my formulas. So, I don't have a problem getting the solution I need, it is just making it look nice when calling the formula from a cell.
It wouldn't be too big of a deal, but I'm not the only one useing these formulas. If I pass this off to someone else, they will just see combine, and not know what it takes as parameters...
Thank you for the timely response though!![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks