PC Review


Reply
Thread Tools Rate Thread

Change a field and delete row

 
 
Albert
Guest
Posts: n/a
 
      30th Jan 2008
Hi Guys,

I would like to delete the row if a column "status" changes to "closed.

this is what I got, but of course it is not working can you help?

Dim cnclrge As Range
' If ActiveCell.Offset(0, 17) = "Closed" Then
'
' cnclrge.EntireRow.Delete
' End If

Thanks
Albert
 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      30th Jan 2008
If ActiveCell.Offset(0, 17) = "Closed" Then activecell.EntireRow.Delete


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Albert" <(E-Mail Removed)> wrote in message
newsE275095-252C-4AFF-84C3-(E-Mail Removed)...
> Hi Guys,
>
> I would like to delete the row if a column "status" changes to "closed.
>
> this is what I got, but of course it is not working can you help?
>
> Dim cnclrge As Range
> ' If ActiveCell.Offset(0, 17) = "Closed" Then
> '
> ' cnclrge.EntireRow.Delete
> ' End If
>
> Thanks
> Albert


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      30th Jan 2008
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "Q:Q" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
If Target.Value = "Closed" Then Target.EntireRow.Delete
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Albert" <(E-Mail Removed)> wrote in message
newsE275095-252C-4AFF-84C3-(E-Mail Removed)...
> Hi Guys,
>
> I would like to delete the row if a column "status" changes to "closed.
>
> this is what I got, but of course it is not working can you help?
>
> Dim cnclrge As Range
> ' If ActiveCell.Offset(0, 17) = "Closed" Then
> '
> ' cnclrge.EntireRow.Delete
> ' End If
>
> Thanks
> Albert



 
Reply With Quote
 
FSt1
Guest
Posts: n/a
 
      30th Jan 2008
hi
your not setting the active cell to equal cnclrge.
Dim cnclrge As Range
set cnclrge = activecell
If ActiveCell.Offset(0, 17) = "Closed" Then
cnclrge.EntireRow.Delete
'or Activecell.EntireEow.Delete
end if

Personally i dislike using Activecell and perfer using variables but
everyone has your own way.

Regards
FSt1
"Albert" wrote:

> Hi Guys,
>
> I would like to delete the row if a column "status" changes to "closed.
>
> this is what I got, but of course it is not working can you help?
>
> Dim cnclrge As Range
> ' If ActiveCell.Offset(0, 17) = "Closed" Then
> '
> ' cnclrge.EntireRow.Delete
> ' end if
> Thanks
> Albert

 
Reply With Quote
 
Albert
Guest
Posts: n/a
 
      31st Jan 2008
Thanks guys, sorted.

"FSt1" wrote:

> hi
> your not setting the active cell to equal cnclrge.
> Dim cnclrge As Range
> set cnclrge = activecell
> If ActiveCell.Offset(0, 17) = "Closed" Then
> cnclrge.EntireRow.Delete
> 'or Activecell.EntireEow.Delete
> end if
>
> Personally i dislike using Activecell and perfer using variables but
> everyone has your own way.
>
> Regards
> FSt1
> "Albert" wrote:
>
> > Hi Guys,
> >
> > I would like to delete the row if a column "status" changes to "closed.
> >
> > this is what I got, but of course it is not working can you help?
> >
> > Dim cnclrge As Range
> > ' If ActiveCell.Offset(0, 17) = "Closed" Then
> > '
> > ' cnclrge.EntireRow.Delete
> > ' end if
> > Thanks
> > Albert

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I use a keyboard to change a PivotTable or delete a field? =?Utf-8?B?YnVydGluaEBhdGFjLmNvbQ==?= Microsoft Excel Misc 1 4th Feb 2006 07:37 PM
How do I use a keyboard to change a PivotTable or delete a field? =?Utf-8?B?YnVydGluaEBhdGFjLmNvbQ==?= Microsoft Excel Misc 1 4th Feb 2006 05:10 PM
Can't change/delete certain field =?Utf-8?B?amVubmE=?= Microsoft Access Forms 0 17th Apr 2005 05:51 AM
How do I delete data in a field in Access but not delete the whol. =?Utf-8?B?TGVhbm5l?= Microsoft Access Queries 1 5th Mar 2005 10:27 PM
Delete all records matching a field except for one based on an includeddate field naniboujou Microsoft Access Queries 3 13th Dec 2003 03:31 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:26 PM.