Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 262
Default Excel: Code to delete entire rows when font is Strikethrough?

I have a spreadsheet where some rows are formatted with strikethrough font.
I need some code to delete the entire row where the font is set to strike
through.

Thanks,

Keith
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Excel: Code to delete entire rows when font is Strikethrough?

Hi Keith,

Are the entire rows formatted to strikethrough? If so then the following
code should do what you want. If not the entire row formatted to
strikethrouth then will need to know the specific columns that are.

Note: It is necessary to work backwards from the bottom when deleting rows.

Sub DeleteStrikeThrough()
Dim rngRow As Range
Dim r As Long

For r = Sheets("Sheet1").UsedRange.Rows.Count To 1 Step -1
If Rows(r).Font.Strikethrough = True Then
Rows(r).Delete
End If
Next r

End Sub


--
Regards,

OssieMac


"Keith" wrote:

I have a spreadsheet where some rows are formatted with strikethrough font.
I need some code to delete the entire row where the font is set to strike
through.

Thanks,

Keith

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Excel: Code to delete entire rows when font is Strikethrough?

Hi again Keith,

If not the entire row, if you have a specific column that will have the
strickthrough then the following will do what you want. Just replace the "A"
in Cells(r,"A") with whatever column you wish.

Also in the previous post, delete the line Dim rngRow As Range. I initially
was going to do it a different way and didn't remove the line.

Sub DeleteStrikeThrough2()
Dim r As Long

For r = Sheets("Sheet1").UsedRange.Rows.Count To 1 Step -1
If Cells(r, "A").Font.Strikethrough = True Then
Cells(r, "A").EntireRow.Delete
End If
Next r

End Sub

--
Regards,

OssieMac


"OssieMac" wrote:

Hi Keith,

Are the entire rows formatted to strikethrough? If so then the following
code should do what you want. If not the entire row formatted to
strikethrouth then will need to know the specific columns that are.

Note: It is necessary to work backwards from the bottom when deleting rows.

Sub DeleteStrikeThrough()
Dim rngRow As Range
Dim r As Long

For r = Sheets("Sheet1").UsedRange.Rows.Count To 1 Step -1
If Rows(r).Font.Strikethrough = True Then
Rows(r).Delete
End If
Next r

End Sub


--
Regards,

OssieMac


"Keith" wrote:

I have a spreadsheet where some rows are formatted with strikethrough font.
I need some code to delete the entire row where the font is set to strike
through.

Thanks,

Keith

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 262
Default Excel: Code to delete entire rows when font is Strikethrough?

Thanks OsieMac,

It works well.
Does just what I need.


Regards,

Keith



"OssieMac" wrote:

Hi again Keith,

If not the entire row, if you have a specific column that will have the
strickthrough then the following will do what you want. Just replace the "A"
in Cells(r,"A") with whatever column you wish.

Also in the previous post, delete the line Dim rngRow As Range. I initially
was going to do it a different way and didn't remove the line.

Sub DeleteStrikeThrough2()
Dim r As Long

For r = Sheets("Sheet1").UsedRange.Rows.Count To 1 Step -1
If Cells(r, "A").Font.Strikethrough = True Then
Cells(r, "A").EntireRow.Delete
End If
Next r

End Sub

--
Regards,

OssieMac


"OssieMac" wrote:

Hi Keith,

Are the entire rows formatted to strikethrough? If so then the following
code should do what you want. If not the entire row formatted to
strikethrouth then will need to know the specific columns that are.

Note: It is necessary to work backwards from the bottom when deleting rows.

Sub DeleteStrikeThrough()
Dim rngRow As Range
Dim r As Long

For r = Sheets("Sheet1").UsedRange.Rows.Count To 1 Step -1
If Rows(r).Font.Strikethrough = True Then
Rows(r).Delete
End If
Next r

End Sub


--
Regards,

OssieMac


"Keith" wrote:

I have a spreadsheet where some rows are formatted with strikethrough font.
I need some code to delete the entire row where the font is set to strike
through.

Thanks,

Keith

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default Excel: Code to delete entire rows when font is Strikethrough?

Hi. Just a note if it applies. This assumes data is in Row 1.

For r = Sheets("Sheet1").UsedRange.Rows.Count To 1 Step -1


For example, if you only have data in A5:B7, then there are 3 rows, and
not the assumed 7.

Sub DeleteStrikeThrough2()
Dim r As Long

For r = Sheets("Sheet1").UsedRange.Rows.Count To 1 Step -1
Debug.Print r
Next r
End Sub

This returns 3,2,1 and not 7,6,5,4,3,2,1
Again, just a heads-up.
- - -
Dana DeLouis


OssieMac wrote:
Hi again Keith,

If not the entire row, if you have a specific column that will have the
strickthrough then the following will do what you want. Just replace the "A"
in Cells(r,"A") with whatever column you wish.

Also in the previous post, delete the line Dim rngRow As Range. I initially
was going to do it a different way and didn't remove the line.

Sub DeleteStrikeThrough2()
Dim r As Long

For r = Sheets("Sheet1").UsedRange.Rows.Count To 1 Step -1
If Cells(r, "A").Font.Strikethrough = True Then
Cells(r, "A").EntireRow.Delete
End If
Next r

End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Excel: Code to delete entire rows when font is Strikethrough?

I have applied conditional formating in column k asking to Strikethrough if
condition is met, but the below macro is not not working with conditional
formating.. Pls help



"OssieMac" wrote:

Hi again Keith,

If not the entire row, if you have a specific column that will have the
strickthrough then the following will do what you want. Just replace the "A"
in Cells(r,"A") with whatever column you wish.

Also in the previous post, delete the line Dim rngRow As Range. I initially
was going to do it a different way and didn't remove the line.

Sub DeleteStrikeThrough2()
Dim r As Long

For r = Sheets("Sheet1").UsedRange.Rows.Count To 1 Step -1
If Cells(r, "A").Font.Strikethrough = True Then
Cells(r, "A").EntireRow.Delete
End If
Next r

End Sub

--
Regards,

OssieMac


"OssieMac" wrote:

Hi Keith,

Are the entire rows formatted to strikethrough? If so then the following
code should do what you want. If not the entire row formatted to
strikethrouth then will need to know the specific columns that are.

Note: It is necessary to work backwards from the bottom when deleting rows.

Sub DeleteStrikeThrough()
Dim rngRow As Range
Dim r As Long

For r = Sheets("Sheet1").UsedRange.Rows.Count To 1 Step -1
If Rows(r).Font.Strikethrough = True Then
Rows(r).Delete
End If
Next r

End Sub


--
Regards,

OssieMac


"Keith" wrote:

I have a spreadsheet where some rows are formatted with strikethrough font.
I need some code to delete the entire row where the font is set to strike
through.

Thanks,

Keith

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 262
Default Excel: Code to delete entire rows when font is Strikethrough?

Hello OssieMac,

Thanks for the quick response,

The entire row is not formatted as strike through, only columns A to M.
Could we just base it on Column A?


"OssieMac" wrote:

Hi Keith,

Are the entire rows formatted to strikethrough? If so then the following
code should do what you want. If not the entire row formatted to
strikethrouth then will need to know the specific columns that are.

Note: It is necessary to work backwards from the bottom when deleting rows.

Sub DeleteStrikeThrough()
Dim rngRow As Range
Dim r As Long

For r = Sheets("Sheet1").UsedRange.Rows.Count To 1 Step -1
If Rows(r).Font.Strikethrough = True Then
Rows(r).Delete
End If
Next r

End Sub


--
Regards,

OssieMac


"Keith" wrote:

I have a spreadsheet where some rows are formatted with strikethrough font.
I need some code to delete the entire row where the font is set to strike
through.

Thanks,

Keith

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Excel: Code to delete entire rows when font is Strikethrough?

Obviously you posted this before my second post showed up which does base it
on column A.

--
Regards,

OssieMac


"Keith" wrote:

Hello OssieMac,

Thanks for the quick response,

The entire row is not formatted as strike through, only columns A to M.
Could we just base it on Column A?


"OssieMac" wrote:

Hi Keith,

Are the entire rows formatted to strikethrough? If so then the following
code should do what you want. If not the entire row formatted to
strikethrouth then will need to know the specific columns that are.

Note: It is necessary to work backwards from the bottom when deleting rows.

Sub DeleteStrikeThrough()
Dim rngRow As Range
Dim r As Long

For r = Sheets("Sheet1").UsedRange.Rows.Count To 1 Step -1
If Rows(r).Font.Strikethrough = True Then
Rows(r).Delete
End If
Next r

End Sub


--
Regards,

OssieMac


"Keith" wrote:

I have a spreadsheet where some rows are formatted with strikethrough font.
I need some code to delete the entire row where the font is set to strike
through.

Thanks,

Keith

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I test in a formula if my font is strikethrough or not? JFD_TP Excel Discussion (Misc queries) 1 April 20th 07 03:11 PM
Count cells with strikethrough font? Mike Echo Excel Worksheet Functions 2 November 4th 05 08:42 AM
Strikethrough and Underline Font Macro Rainman Excel Worksheet Functions 0 August 9th 05 01:32 PM
Font strikethrough Ben Excel Programming 5 November 19th 04 02:59 AM
Check font strikethrough Ben Excel Programming 2 November 4th 04 06:38 AM


All times are GMT +1. The time now is 05:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"