Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Change a field and delete row

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Change a field and delete row

If ActiveCell.Offset(0, 17) = "Closed" Then activecell.EntireRow.Delete


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Albert" wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Change a field and delete row

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" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Change a field and delete row

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Change a field and delete row

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
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
Delete calculated field deb Excel Discussion (Misc queries) 1 June 2nd 09 08:14 PM
Unable to change field settings in calculated field in a pivot tab Mike Excel Discussion (Misc queries) 0 September 25th 06 07:45 PM
How do I use a keyboard to change a PivotTable or delete a field? [email protected] Excel Discussion (Misc queries) 1 February 4th 06 07:37 PM
How do I use a keyboard to change a PivotTable or delete a field? [email protected] Excel Discussion (Misc queries) 1 February 4th 06 05:10 PM
If field in column is blank, delete if.... CPower[_30_] Excel Programming 1 August 6th 04 03:23 AM


All times are GMT +1. The time now is 10:08 AM.

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

About Us

"It's about Microsoft Excel"