ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Question about looping (https://www.excelbanter.com/excel-programming/413923-question-about-looping.html)

Brad

Question about looping
 

What I want to do is to put the following two lines in a loop.

shtFixD.Rows("FixedFooter" & i).Delete
ActiveWorkbook.Names("FixedFooter" & i).Delete

Where I know the numbers start with 1 and increment by one. What I don't
know is how many "Footers" I have. How can I do this??


Bob Phillips[_3_]

Question about looping
 
What is FixedFooter? What is i? I would normally expect a loop to identify a
key column, and identify the last row of that, and loop until the end of
that.

--
__________________________________
HTH

Bob

"Brad" wrote in message
...

What I want to do is to put the following two lines in a loop.

shtFixD.Rows("FixedFooter" & i).Delete
ActiveWorkbook.Names("FixedFooter" & i).Delete

Where I know the numbers start with 1 and increment by one. What I don't
know is how many "Footers" I have. How can I do this??




Jim Thomlinson

Question about looping
 
This should be close to what you want...

Sub DeleteStuff()
Dim nme As Name

For Each nme In ThisWorkbook.Names
With nme
If LCase(Left(.Name, 11)) = "fixedfooter" Then
.RefersToRange.EntireRow.Delete
.Delete
End If
End With
Next nme

End Sub
--
HTH...

Jim Thomlinson


"Brad" wrote:


What I want to do is to put the following two lines in a loop.

shtFixD.Rows("FixedFooter" & i).Delete
ActiveWorkbook.Names("FixedFooter" & i).Delete

Where I know the numbers start with 1 and increment by one. What I don't
know is how many "Footers" I have. How can I do this??


Brad

Question about looping
 
Thank you!!
--
Wag more, bark less


"Jim Thomlinson" wrote:

This should be close to what you want...

Sub DeleteStuff()
Dim nme As Name

For Each nme In ThisWorkbook.Names
With nme
If LCase(Left(.Name, 11)) = "fixedfooter" Then
.RefersToRange.EntireRow.Delete
.Delete
End If
End With
Next nme

End Sub
--
HTH...

Jim Thomlinson


"Brad" wrote:


What I want to do is to put the following two lines in a loop.

shtFixD.Rows("FixedFooter" & i).Delete
ActiveWorkbook.Names("FixedFooter" & i).Delete

Where I know the numbers start with 1 and increment by one. What I don't
know is how many "Footers" I have. How can I do this??



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com