Grey Fill for all cells that contain a certain string in hyperlinkaddress

A

andreashermle

Dear Experts:

I would like to achieve the following using a macro:

I got a workbook with several sheets. Most of the cells of these
worksheets contain hyperlink addresses.

The requirements for the macro are as follows:

Format all cells of all the worksheets with a grey fill where the
hyperlink address contains the string '%20'.

I am referring to the actual hyperlink address NOT the displayed
name.

Help is much appreciated. Thank you very much in advance.
 
D

Don Guillett Excel MVP

Dear Experts:

I would like to achieve the following using a macro:

I got a workbook with several sheets. Most of the cells of these
worksheets contain hyperlink addresses.

The requirements for the macro are as follows:

Format all cells of all the worksheets with a grey fill where the
hyperlink address contains the string '%20'.

I am referring to the actual hyperlink address NOT the displayed
name.

Help is much appreciated. Thank you very much in advance.

Sub HyperlinksInteriorColorIndexSAS()
Dim i As Long
Dim H As Hyperlink
For i = 1 To Worksheets.Count
For Each H In Sheets(i).Hyperlinks
If InStr(H.Address, "%20") Then
. MsgBox H.Range.Address
Sheets(i).Range(H.Range.Address).Interior.ColorIndex = 15
End If
Next H
Next i
End Sub
 
D

Don Guillett Excel MVP

Dear Experts:

I would like to achieve the following using a macro:

I got a workbook with several sheets. Most of the cells of these
worksheets contain hyperlink addresses.

The requirements for the macro are as follows:

Format all cells of all the worksheets with a grey fill where the
hyperlink address contains the string '%20'.

I am referring to the actual hyperlink address NOT the displayed
name.

Help is much appreciated. Thank you very much in advance.

Sub HyperlinksInteriorColorIndexSAS()
Dim i As Long
Dim H As Hyperlink
For i = 1 To Worksheets.Count
For Each H In Sheets(i).Hyperlinks
If InStr(H.Address, "%20") Then
MsgBox H.Range.Address
Sheets(i).Range(H.Range.Address).Interior.ColorIndex = 4
End If
Next H
Next i
End Sub
 
A

andreashermle

Sub HyperlinksInteriorColorIndexSAS()
Dim i As Long
Dim H As Hyperlink
 For i = 1 To Worksheets.Count
 For Each H In Sheets(i).Hyperlinks
 If InStr(H.Address, "%20") Then
  MsgBox H.Range.Address
  Sheets(i).Range(H.Range.Address).Interior.ColorIndex = 4
 End If
Next H
Next i
End Sub- Zitierten Text ausblenden -

- Zitierten Text anzeigen -

Hi Don,

Great, exactly what I wanted. Thank you very much for your
professinal help.

Regards, Andreas
 
D

Don Guillett Excel MVP

Hi Don,

Great, exactly what I wanted.  Thank you very much for your
professinal help.

Regards, Andreas- Hide quoted text -

- Show quoted text -

Glad to help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top