If cell has links!

Daghs

New Member
Joined
Apr 17, 2021
Messages
16
Office Version
  1. 2010
Platform
  1. Windows
Hi
I need help about vba macro,
The thing is if any cell in column "c" has web link, it will be spared all other cells would be deleted (shift cells up)
Just this is my required!
Now I do know vba, but not that much to be able to write a code by myself so if any friend could help me here,
Thanks!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try the following macro:
VBA Code:
Sub LFHlink()
Dim I As Long, hlCnt As Long
'
Application.ScreenUpdating = False
Application.EnableEvents = False
For I = Cells(Rows.Count, "C").End(xlUp).Row To 2 Step -1
    hlCnt = Cells(I, "C").Hyperlinks.Count
    If hlCnt = 0 Then Cells(I, "C").EntireRow.Delete xlShiftUp
Next I
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
First select the right sheet, then run the macro; it will delete ANY ROW whose column C doesn't contain a hyperlink.
This operation cannot get undone, so you must create a backup copy of your file before running the macro.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,886
Messages
6,175,190
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top