Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10
Default Auto delete.....

Hai I am maintaining a template which having values and blanks. I want to
delete the blank rows. I wrote program as
Sub DelRows()
Dim c As Range

strfind = InputBox("enter value to find and delete")

With Worksheets(1).Range("A:A")
Do
Set c = .Find(strfind, LookIn:=xlValues, lookat:=xlPart, _
MatchCase:=False)
If c Is Nothing Then Exit Do
c.EntireRow.Delete
Loop
End With
End Sub

Its working very fine. but the fact is i had locked certain cells and my
worksheet & workbook is password protected. the code above is not working for
this case. Please anyone help me to solve my problem
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4,624
Default Auto delete.....

One way:

You can unprotect your worksheet in the macro, then protect it again:

Public Sub DelRows()
Const sPWORD As String = "drowssap"
Dim c As Range
Dim strfind As String

strfind = InputBox("enter value to find and delete")

With Worksheets(1)
.Unprotect Password:=sPWORD
With .Range("A:A")
Do
Set c = .Find( _
What:=strfind, _
LookIn:=xlValues, _
LookAt:=xlPart, _
MatchCase:=False)
If c Is Nothing Then Exit Do
c.EntireRow.Delete
Loop
End With
.Protect Password:=sPWORD
End With
End Sub






In article ,
gane wrote:

Hai I am maintaining a template which having values and blanks. I want to
delete the blank rows. I wrote program as
Sub DelRows()
Dim c As Range

strfind = InputBox("enter value to find and delete")

With Worksheets(1).Range("A:A")
Do
Set c = .Find(strfind, LookIn:=xlValues, lookat:=xlPart, _
MatchCase:=False)
If c Is Nothing Then Exit Do
c.EntireRow.Delete
Loop
End With
End Sub

Its working very fine. but the fact is i had locked certain cells and my
worksheet & workbook is password protected. the code above is not working for
this case. Please anyone help me to solve my problem

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10
Default Auto delete.....

thanks itz working great..........

"JE McGimpsey" wrote:

One way:

You can unprotect your worksheet in the macro, then protect it again:

Public Sub DelRows()
Const sPWORD As String = "drowssap"
Dim c As Range
Dim strfind As String

strfind = InputBox("enter value to find and delete")

With Worksheets(1)
.Unprotect Password:=sPWORD
With .Range("A:A")
Do
Set c = .Find( _
What:=strfind, _
LookIn:=xlValues, _
LookAt:=xlPart, _
MatchCase:=False)
If c Is Nothing Then Exit Do
c.EntireRow.Delete
Loop
End With
.Protect Password:=sPWORD
End With
End Sub






In article ,
gane wrote:

Hai I am maintaining a template which having values and blanks. I want to
delete the blank rows. I wrote program as
Sub DelRows()
Dim c As Range

strfind = InputBox("enter value to find and delete")

With Worksheets(1).Range("A:A")
Do
Set c = .Find(strfind, LookIn:=xlValues, lookat:=xlPart, _
MatchCase:=False)
If c Is Nothing Then Exit Do
c.EntireRow.Delete
Loop
End With
End Sub

Its working very fine. but the fact is i had locked certain cells and my
worksheet & workbook is password protected. the code above is not working for
this case. Please anyone help me to solve my problem


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
Is it possible in Excel to have a file auto delete on a given dat. Van Excel Worksheet Functions 6 October 9th 07 09:50 PM
Macro auto insert/delete Eric Excel Discussion (Misc queries) 3 June 12th 07 09:09 PM
Auto delete cell content [email protected] Excel Discussion (Misc queries) 1 March 13th 07 01:43 PM
Auto-delete Unbolded Cells John Walker Excel Worksheet Functions 2 March 30th 06 09:37 PM
how to delete an auto footer Dool Excel Discussion (Misc queries) 4 June 10th 05 01:19 PM


All times are GMT +1. The time now is 01:12 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"