Daily tips for using Microsoft Excel.

Thursday, April 18, 2002

Mel asks: Is there a way to remove multiple (900) hyperlinks? I would like to retain the data, but not have it as a hyperlink. I would also like to accomplish in groups or all at once, rather then individually.

In Excel 2002:
Highlight all the cells.
Right click, select hyperlink from the pop-up menu.
Click the Remove button.

In Excel 2000 they did not offer this functionality. You could do it with VBA:
Sub RemoveHyperLinks()
Range("A2:A999").Hyperlinks.Delete
End Sub

For info about entering a VBA macro, see this page.

Wednesday, April 17, 2002

Emily asks, "Please could you advise the formular solution for counting the number of cells that have a particular backgorund colour (i.e. these cells contain some data however the colour is what's important in order to count them).
"Logically I feel it should follow a standard formular i.e.
CountIF(A01:A55,"backgroundcolour=red")
I believe the colour red should be identified by the number 3 (according the the help file)
I need to know how to code the background cell colour i.e. colorfill?, backgroundcolour?, interior.color?...???

Emily - if only it were that easy. You need to have a User Defined Function in VBA. Below is the code for the function. You need to enter this in a new code module in the workbook. If you are unfamiliar with VBA, read this page.

Once you have the code entered, you can use this formula:
=countcolor(A1:A99,D2)
Where D2 has the background format that you want to count.

Here is the code:


Function CountColor(Rng As Range, RngColor As Range) As Integer
Dim Cll As Range
Dim Clr As Long
Clr = RngColor.Range("A1").Interior.Color
For Each Cll In Rng
If Cll.Interior.Color = Clr Then
CountColor = CountColor + 1
End If
Next Cll
End Function

Tuesday, April 16, 2002

Ivo asks: I was wondering how to separate a column with email@domain.com in to columns [email] and [@domain.com]

There are a couple functions you will use to do this.

=FIND("@",A2) will tell you which position contains the @ in a cell. In your example, this would return position 6.

You can then use =LEFT(A2,FIND("@",A2)-1) to return email
and =MID(A2,FIND("@",A2),LEN(A2)+1-FIND("@",A2)) to return @domain.com

P.S. - Juan Pablo just pointed out that you could do this easily with Data > Text to Columns. Choose Delimited text and make the delimiter be the @ sign.